【MATLAB】App 设计 (入门)

设计APP

在这里插入图片描述

主界面

在这里插入图片描述

函数方法

定时器

classdef MemoryMonitorAppExample < matlab.apps.AppBase% Properties that correspond to app componentsproperties (Access = public)UIFigure     matlab.ui.FigureStopButton   matlab.ui.control.ButtonStartButton  matlab.ui.control.ButtonSubtitle     matlab.ui.control.LabelTitle        matlab.ui.control.LabelUIAxes       matlab.ui.control.UIAxesendproperties (Access = private)RandTimer          % Timer objectPlotLine           % Line objectendmethods (Access = private)function RandTimerFcn(app,~,~)% Generate a random numberrandnum = rand;% Update YData in plotydata = app.PlotLine.YData;ydata = circshift(ydata,1);ydata(1) = randnum;app.PlotLine.YData = ydata;end        end% Callbacks that handle component eventsmethods (Access = private)% Code that executes after component creationfunction startupFcn(app)% Configure x- and y- axisapp.UIAxes.XLim = [0 60];app.UIAxes.XDir = "reverse";app.UIAxes.YLim = [0 1];% Initial plot is all zerosapp.PlotLine = plot(app.UIAxes,0:60,zeros(1,61));% Create timer objectapp.RandTimer = timer(..."ExecutionMode", "fixedRate", ...    % Run timer repeatedly"Period", 1, ...                     % Period is 1 second"BusyMode", "queue",...              % Queue timer callbacks when busy"TimerFcn", @app.RandTimerFcn);      % Specify callback functionend% Button pushed function: StartButtonfunction StartButtonPushed(app, event)% If timer is not running, start itif strcmp(app.RandTimer.Running, "off")start(app.RandTimer);endend% Button pushed function: StopButtonfunction StopButtonPushed(app, event)% Stop the timerstop(app.RandTimer);end% Close request function: UIFigurefunction UIFigureCloseRequest(app, event)% Stop timer, then delete timer and appstop(app.RandTimer);delete(app.RandTimer);delete(app);endend% Component initializationmethods (Access = private)% Create UIFigure and componentsfunction createComponents(app)% Create UIFigure and hide until all components are createdapp.UIFigure = uifigure('Visible', 'off');app.UIFigure.Position = [100 100 640 480];app.UIFigure.Name = 'Random Number Generator';app.UIFigure.Resize = 'off';app.UIFigure.CloseRequestFcn = createCallbackFcn(app, @UIFigureCloseRequest, true);% Create UIAxesapp.UIAxes = uiaxes(app.UIFigure);xlabel(app.UIAxes, 'Seconds')ylabel(app.UIAxes, 'Random number calculated')app.UIAxes.XTickLabelRotation = 0;app.UIAxes.YTickLabelRotation = 0;app.UIAxes.ZTickLabelRotation = 0;app.UIAxes.Box = 'on';app.UIAxes.XGrid = 'on';app.UIAxes.YGrid = 'on';app.UIAxes.Position = [53 100 508 300];% Create Titleapp.Title = uilabel(app.UIFigure);app.Title.HorizontalAlignment = 'center';app.Title.FontSize = 16;app.Title.Position = [267 430 108 22];app.Title.Text = 'Output of rand';% Create Subtitleapp.Subtitle = uilabel(app.UIFigure);app.Subtitle.Position = [253 409 140 22];app.Subtitle.Text = 'Calculated Every Second';% Create StartButtonapp.StartButton = uibutton(app.UIFigure, 'push');app.StartButton.ButtonPushedFcn = createCallbackFcn(app, @StartButtonPushed, true);app.StartButton.Position = [197 59 100 22];app.StartButton.Text = 'Start';% Create StopButtonapp.StopButton = uibutton(app.UIFigure, 'push');app.StopButton.ButtonPushedFcn = createCallbackFcn(app, @StopButtonPushed, true);app.StopButton.Position = [348 59 100 22];app.StopButton.Text = 'Stop';% Show the figure after all components are createdapp.UIFigure.Visible = 'on';endend% App creation and deletionmethods (Access = public)% Construct appfunction app = MemoryMonitorAppExample% Create UIFigure and componentscreateComponents(app)% Register the app with App DesignerregisterApp(app, app.UIFigure)% Execute the startup functionrunStartupFcn(app, @startupFcn)if nargout == 0clear appendend% Code that executes before app deletionfunction delete(app)% Delete UIFigure when app is deleteddelete(app.UIFigure)endend
end

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/web/951.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

大模型ChatGPT里面的一些技术和发展方向

文章目录 如何炼成ChatGPT如何调教ChatGPT如何武装ChatGPT一些大模型的其他方向 这个是基于视频 https://www.bilibili.com/video/BV17t4218761&#xff0c;可以了解一下大模型里面的一些技术和最近的发展&#xff0c;基本都是2022你那以来的发展&#xff0c;比较新。然后本文…

SpringMVC 异常没有处理,发送 /error 请求(404 错误)

现象&#xff1a; 在过滤器中进行鉴权时候抛出了异常&#xff0c;此时客户端会收到 404 错误&#xff0c;接口确定是存在&#xff0c;为什么会收到 404 错误呢&#xff1f; {"timestamp": "2024-04-16T03:12:19.83200:00","status": 404,"…

最新版的GPT-4.5-Turbo有多强

OpenAI再次用实力证明了&#xff0c;GPT依然是AI世界最强的玩家&#xff01;在最新的AI基准测试中&#xff0c;OpenAI几天前刚刚发布的GPT-4-Turbo-2024-04-09版本&#xff0c;大幅超越了Claude3 Opus&#xff0c;重新夺回了全球第一的AI王座&#xff1a; 值得一提的是&#xf…

C++ 模板详解——template<class T>

一. 前言 在我们学习C时&#xff0c;常会用到函数重载。而函数重载&#xff0c;通常会需要我们编写较为重复的代码&#xff0c;这就显得臃肿&#xff0c;且效率低下。重载的函数仅仅只是类型不同&#xff0c;代码的复用率比较低&#xff0c;只要有新类型出现时&#xff0c;就需…

LeetCode 34在排序数组中查找元素的第一个和最后一个位置

LeetCode 34在排序数组中查找元素的第一个和最后一个位置 给你一个按照非递减顺序排列的整数数组nums&#xff0c;和一个目标值target。请你找出给定目标值在数组中的开始位置和结束位置。 如果数组中不存在目标值target&#xff0c;返回 [-1, -1]。 你必须设计并实现时间复…

文章解读与仿真程序复现思路——电力自动化设备EI\CSCD\北大核心《考虑碳市场风险的热电联产虚拟电厂低碳调度》

本专栏栏目提供文章与程序复现思路&#xff0c;具体已有的论文与论文源程序可翻阅本博主免费的专栏栏目《论文与完整程序》 论文与完整源程序_电网论文源程序的博客-CSDN博客https://blog.csdn.net/liang674027206/category_12531414.html 电网论文源程序-CSDN博客电网论文源…

【.net core】【sqlsugar】批量更新方法

官方文档&#xff1a;单表更新、更新数据 - SqlSugar 5x - .NET果糖网 泛型类中增加 //更新单个实体 public async Task<int> Update(TEntity entity) {//IgnoreColumns(ignoreAllNullColumns: true)&#xff1a;忽略设置为跳过的列return await _db.Updateable(entity…

Java作业6-Java类的基本概念三

编程1 import java.util.*;abstract class Rodent//抽象类 {public abstract String findFood();//抽象方法public abstract String chewFood(); } class Mouse extends Rodent {public String findFood(){ return "大米"; }public String chewFood(){ return "…

IDEA 编码格式设置 UTF-8

IDEA 编码格式设置 UTF-8 1.文件编码设置为UTF-8 Editor > File Encodings 2.编译编码设置为utf-8 Build&#xff0c;Execution&#xff0c;Deployment > Complier > Java Complier 按图中设置&#xff1a;-encoding utf-8

【数学建模】钻井问题

已知 12口井的坐标位置如下: x[0.50,1.41,3.00,3.37,3.40,4.72,4.72,5.43,7.57,8.38,8.98, 9.50]; y[2.00,3.50,1.50,3.51,5.50,2.00,6.24,4.10,2.01,4.50,3.41,0.80];设平面有n个点 P i P_i Pi​(表旧井井位),其坐标为 ( a i , b i ) , i 1 , 2 , … , n (a_i,b_i),i1,2,…,…

嵌入式学习57-ARM7(字符设备驱动框架led)

kernel 内核 printk 内核打印 cat /proc/devices mknod ? 查看指令 gcc -oapp hello.c

动态库作用举例

1.定义解析 符号地址&#xff1a; 符号地址是指代码中定义的函数、变量或其他标识符的内存地址。在程序编译和链接的过程中&#xff0c;这些符号会被编译器和链接器分配一个具体的内存地址。 每个符号在程序的执行过程中都有一个唯一的地址&#xff0c;用于指示它在内存中的位…

fastapi写一个上传的接口

首先&#xff0c;确保您已经在 Python 环境中安装了 FastAPI。 安装环境&#xff1a; pip install fastapi uvicorn让我们创建一个图片上传的接口&#xff1a; from fastapi import FastAPI, File, UploadFile from fastapi.responses import JSONResponse import shutil im…

Dynamic Wallpaper for Mac:动态壁纸让桌面更生动

Dynamic Wallpaper for Mac是一款为苹果电脑用户精心设计的动态壁纸软件&#xff0c;它以其丰富的功能和精美的壁纸库&#xff0c;为用户带来了更加生动和个性化的桌面体验。 Dynamic Wallpaper for Mac v17.8中文版下载 这款软件支持多种动态壁纸&#xff0c;用户可以根据自己…

AirServer投屏软件

AirServer下载:https://souurl.cn/7xWmKW AirServer是一款功能强大的屏幕镜像接收器&#xff0c;它适用于Mac和PC&#xff0c;允许用户接收来自iOS、Android、Mac和Windows等设备的AirPlay和Google Cast流。这款软件可以让用户将手机或平板电脑的屏幕内容无线投射到电脑上&…

2024.4.19力扣每日一题——准时抵达会议现场的最小跳过休息次数

2024.4.19 题目来源我的题解方法一 动态规划浮点数精度方法二 动态规划不考虑浮点数精度问题 题目来源 力扣每日一题&#xff1b;题序&#xff1a;1883 我的题解 方法一 动态规划浮点数精度 参考官方题解。 用 f[i][j]表示经过了 dist[0]到 dist[i−1]的 i 段道路&#xff0…

ORACLE错误提示概述

OceanBase分布式数据库-海量数据 笔笔算数 保存起来方便自己查看错误代码。 ORA-00001: 违反唯一约束条件 (.) ORA-00017: 请求会话以设置跟踪事件 ORA-00018: 超出最大会话数 ORA-00019: 超出最大会话许可数 ORA-00020: 超出最大进程数 () ORA-00021: 会话附属于其它某些进程…

PTA L2-047 锦标赛

题目 解析 把每一场比赛看作满二叉树的一个节点&#xff0c;父节点递归遍历子节点的结果&#xff0c;进行试填。 代码 #include <bits/stdc.h>using i64 long long;struct Node {int win, lose; };void solve() {int k;std::cin >> k;int siz (1 << k);…

【YOLOv8改进[Backbone]】使用MobileNetV3助力YOLOv8网络结构轻量化并助力涨点

目录 一 MobileNetV3 1 面向块搜索的平台感知NAS和NetAdapt 2 反向残差和线性瓶颈 二 使用MobileNetV3助力YOLOv8 1 整体修改 ① 添加MobileNetV3.py文件 ② 修改ultralytics/nn/tasks.py文件 ③ 修改ultralytics/utils/torch_utils.py文件 2 配置文件 3 训练 其他 …

如何查看项目中使用的Qt版本

如何查看项目中使用的Qt版本 1.点击左下角电脑按钮查看Qt版本。 2.点击左侧栏项目按钮查看Qt版本。