Matlab电子日志app

使用Matlab App Designer设计一个 电子日志app

由于坚持记录已经有一段时间,决定DIY一款app用于记录,主要包含以下功能:记录每日时间分配并查看;记录阅读书籍并查看;记录练习歌曲并查看;记录体重并查看;记录notes并查看;添加类别并记录倒计时功能(目前还不完善)。。。
安装程序下载
百度网盘下载链接:https://pan.baidu.com/s/1uCuPcgs2HQ3crx3LLb0kuw
提取码:j1m0
设计页面如下:
在这里插入图片描述

具体代码。。。

classdef app_record < matlab.apps.AppBase

    % Properties that correspond to app components
    properties (Access = public)
        UIFigure                matlab.ui.Figure
        UIAxes                  matlab.ui.control.UIAxes
        UIAxes2                 matlab.ui.control.UIAxes
        NotesTextArea           matlab.ui.control.TextArea
        DateSaveDatePicker      matlab.ui.control.DatePicker
        kgEditFieldLabel        matlab.ui.control.Label
        kgEditField             matlab.ui.control.NumericEditField
        SaveButton              matlab.ui.control.Button
        DateCheckDatePicker     matlab.ui.control.DatePicker
        SleepEditFieldLabel     matlab.ui.control.Label
        SleepEditField          matlab.ui.control.NumericEditField
        HobbyEditFieldLabel     matlab.ui.control.Label
        HobbyEditField          matlab.ui.control.NumericEditField
        ResearchEditFieldLabel  matlab.ui.control.Label
        ResearchEditField       matlab.ui.control.NumericEditField
        SocialEditFieldLabel    matlab.ui.control.Label
        SocialEditField         matlab.ui.control.NumericEditField
        TimehLabel              matlab.ui.control.Label
        TotalLabel              matlab.ui.control.Label
        DropDown                matlab.ui.control.DropDown
        BookEditFieldLabel      matlab.ui.control.Label
        BookEditField           matlab.ui.control.EditField
        SongEditFieldLabel      matlab.ui.control.Label
        SongEditField           matlab.ui.control.EditField
        Label_2                 matlab.ui.control.Label
        Label_3                 matlab.ui.control.Label
        Label_4                 matlab.ui.control.Label
        HourSpinnerLabel        matlab.ui.control.Label
        HourSpinner             matlab.ui.control.Spinner
        AddButton               matlab.ui.control.Button
        UITable                 matlab.ui.control.Table
        TextArea                matlab.ui.control.TextArea
        UITable2                matlab.ui.control.Table
        UITable3                matlab.ui.control.Table
        EditField               matlab.ui.control.EditField
    end

    
    properties (Access = public)
        val = load("sim.mat",'notes'); % Description
        val2 = load('sim.mat','t_consumption');
    end
    

    % Callbacks that handle component events
    methods (Access = private)

        % Button pushed function: SaveButton
        function SaveButtonPushed(app, event)
            flag = 0;
            if length(app.NotesTextArea.Value) > 1
                note_combine = strjoin(app.NotesTextArea.Value(1:end));
                n = cellstr(note_combine);
            elseif length(app.NotesTextArea.Value) == 1
                n = app.NotesTextArea.Value;
            end
            if isnat(app.DateSaveDatePicker.Value) == 1
                app.DateSaveDatePicker.Value = datetime('today');
            end
            if isempty(app.BookEditField.Value) == 1
                book = ' ';
            else
                book = app.BookEditField.Value;
            end
            if isempty(app.SongEditField.Value) == 1
                song = ' ';
            else
                song = app.SongEditField.Value;
            end
            for i = 1:length(app.val.notes.Time)
                if app.DateSaveDatePicker.Value == app.val.notes.Time(i)
                    flag = i;
                end
            end
            if flag > 0
                selection = uiconfirm(app.UIFigure,'The record already exists, confirm to overwrite?','Comfirm Overwrite');
                if length(selection) == 2
                    app.val.notes{flag,1} = app.kgEditField.Value;
                    app.val.notes{flag,2} = app.SleepEditField.Value;
                    app.val.notes{flag,3} = app.HobbyEditField.Value;
               
  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值