唤醒手腕 Matlab 游戏编程常用技术知识点详细教程(更新中)
Figure 窗口初始化
figure 使用默认属性值创建一个新的图窗窗口。生成的图窗为当前图窗。f = figure(___) 返回 Figure 对象。可使用 f 在创建图窗后查询或修改其属性。figure(f) 将 f 指定的图窗作为当前图窗,并将其显示在其他所有图窗的上面。
figure(n) 查找 Number 属性等于 n 的图窗,并将其作为当前图窗。如果不存在具有该属性值的图窗,MATLAB® 将创建一个新图窗并将其 Number 属性设置为 n。
指定图窗标题
创建一个图窗并指定 Name 属性。默认情况下,生成的标题包含图窗编号。
figure('Name','Measured Data');
再次指定 Name 属性,但这次将 NumberTitle 属性设置为 ‘off’。生成的标题不包含图窗编号。
figure('Name','Measured Data','NumberTitle','off');
将背景色设置为白色
figure('Color','white')

figure 属性
Alphamap: [1×64 double]BeingDeleted: offBusyAction: 'queue'ButtonDownFcn: ''Children: [0×0 GraphicsPlaceholder]Clipping: onCloseRequestFcn: 'closereq'Color: [0.9400 0.9400 0.9400]Colormap: [256×3 double]ContextMenu: [0×0 GraphicsPlaceholder]CreateFcn: ''CurrentAxes: [0×0 GraphicsPlaceholder]CurrentCharacter: ''CurrentObject: [0×0 GraphicsPlaceholder]CurrentPoint: [0 0]DeleteFcn: ''DockControls: onFileName: ''GraphicsSmoothing: onHandleVisibility: 'on'Icon: ''InnerPosition: [488 342 560 420]IntegerHandle: onInterruptible: onInvertHardcopy: onKeyPressFcn: ''KeyReleaseFcn: ''MenuBar: 'figure' (默认) | 'none'Name: 'Measured Data'NextPlot: 'add'Number: 2NumberTitle: onOuterPosition: [481 334.6000 574.4000 508.8000]PaperOrientation: 'portrait'PaperPosition: [1.3333 3.3125 5.8333 4.3750]PaperPositionMode: 'auto'PaperSize: [8.5000 11]PaperType: 'usletter'PaperUnits: 'inches'Parent: [1×1 Root]Pointer: 'arrow'PointerShapeCData: [16×16 double]PointerShapeHotSpot: [1 1]Position: [488 342 560 420]Renderer: 'opengl'RendererMode: 'auto'Resize: onScrollable: offSelectionType: 'normal'SizeChangedFcn: ''Tag: ''ToolBar: 'auto'Type: 'figure'Units: 'pixels'UserData: []Visible: onWindowButtonDownFcn: ''WindowButtonMotionFcn: ''WindowButtonUpFcn: ''WindowKeyPressFcn: ''WindowKeyReleaseFcn: ''WindowScrollWheelFcn: ''WindowState: 'normal' (默认) | 'minimized' | 'maximized' | 'fullscreen'WindowStyle: 'normal' (默认) | 'modal' | 'docked'
Figure gca 坐标轴
ALim: [0 1]ALimMode: 'auto'AlphaScale: 'linear'Alphamap: [1×64 double]AmbientLightColor: [1 1 1]BeingDeleted: offBox: offBoxStyle: 'back'BusyAction: 'queue'ButtonDownFcn: ''CLim: [0 1]CLimMode: 'auto'CameraPosition: [0.5000 0.5000 9.1603]CameraPositionMode: 'auto'CameraTarget: [0.5000 0.5000 0.5000]CameraTargetMode: 'auto'CameraUpVector: [0 1 0]CameraUpVectorMode: 'auto'CameraViewAngle: 6.6086CameraViewAngleMode: 'auto'Children: [0×0 GraphicsPlaceholder]Clipping: onClippingStyle: '3dbox'Color: [1 1 1]ColorOrder: [7×3 double]ColorOrderIndex: 1ColorScale: 'linear'Colormap: [256×3 double]ContextMenu: [0×0 GraphicsPlaceholder]CreateFcn: ''CurrentPoint: [2×3 double]DataAspectRatio: [1 1 1]DataAspectRatioMode: 'auto'DeleteFcn: ''FontAngle: 'normal'FontName: 'Helvetica'FontSize: 10FontSizeMode: 'auto'FontSmoothing: onFontUnits: 'points'FontWeight: 'normal'GridAlpha: 0.1500GridAlphaMode: 'auto'GridColor: [0.1500 0.1500 0.1500]GridColorMode: 'auto'GridLineStyle: '-'HandleVisibility: 'on'HitTest: onInnerPosition: [0.1300 0.1100 0.7750 0.8150]Interactions: [1×1 matlab.graphics.interaction.interface.DefaultAxesInteractionSet]Interruptible: onLabelFontSizeMultiplier: 1.1000Layer: 'bottom'Layout: [0×0 matlab.ui.layout.LayoutOptions]Legend: [0×0 GraphicsPlaceholder]LineStyleOrder: '-'LineStyleOrderIndex: 1LineWidth: 0.5000MinorGridAlpha: 0.2500MinorGridAlphaMode: 'auto'MinorGridColor: [0.1000 0.1000 0.1000]MinorGridColorMode: 'auto'MinorGridLineStyle: ':'NextPlot: 'replace'NextSeriesIndex: 1OuterPosition: [0 0 1 1]Parent: [1×1 Figure]PickableParts: 'visible'PlotBoxAspectRatio: [1 0.7882 0.7882]PlotBoxAspectRatioMode: 'auto'Position: [0.1300 0.1100 0.7750 0.8150]PositionConstraint: 'outerposition'Projection: 'orthographic'Selected: offSelectionHighlight: onSortMethod: 'childorder'Subtitle: [1×1 Text]SubtitleFontWeight: 'normal'Tag: ''TickDir: 'in'TickDirMode: 'auto'TickLabelInterpreter: 'tex'TickLength: [0.0100 0.0250]TightInset: [0.0438 0.0527 0.0171 0.0200]Title: [1×1 Text]TitleFontSizeMultiplier: 1.1000TitleFontWeight: 'bold'TitleHorizontalAlignment: 'center'Toolbar: [1×1 AxesToolbar]Type: 'axes'Units: 'normalized'UserData: []View: [0 90]Visible: onXAxis: [1×1 NumericRuler]XAxisLocation: 'bottom'XColor: [0.1500 0.1500 0.1500]XColorMode: 'auto'XDir: 'normal'XGrid: offXLabel: [1×1 Text]XLim: [0 1]XLimMode: 'auto'XLimitMethod: 'tickaligned'XMinorGrid: offXMinorTick: offXScale: 'linear'XTick: [1×11 double]XTickLabel: {11×1 cell}XTickLabelMode: 'auto'XTickLabelRotation: 0XTickMode: 'auto'YAxis: [1×1 NumericRuler]YAxisLocation: 'left'YColor: [0.1500 0.1500 0.1500]YColorMode: 'auto'YDir: 'normal'YGrid: offYLabel: [1×1 Text]YLim: [0 1]YLimMode: 'auto'YLimitMethod: 'tickaligned'YMinorGrid: offYMinorTick: offYScale: 'linear'YTick: [1×11 double]YTickLabel: {11×1 cell}YTickLabelMode: 'auto'YTickLabelRotation: 0YTickMode: 'auto'ZAxis: [1×1 NumericRuler]ZColor: [0.1500 0.1500 0.1500]ZColorMode: 'auto'ZDir: 'normal'ZGrid: offZLabel: [1×1 Text]ZLim: [0 1]ZLimMode: 'auto'ZLimitMethod: 'tickaligned'ZMinorGrid: offZMinorTick: offZScale: 'linear'ZTick: [0 0.5000 1]ZTickLabel: ''ZTickLabelMode: 'auto'ZTickLabelRotation: 0ZTickMode: 'auto'
Figure 窗口监听鼠标事件
MATLAB 中 Figure 窗口可以监听鼠标事件。常见的鼠标事件:
鼠标按下:WindowButtonDownFcn
set(fig, 'WindowButtonDownFcn', @mouseButtonDownCallback);
鼠标松开:WindowButtonUpFcn
set(fig, 'WindowButtonUpFcn', @mouseButtonUpCallback);
鼠标移动:WindowButtonMotionFcn
set(fig, 'WindowButtonMotionFcn', @mouseMoveCallback);
鼠标进入:WindowEnterFcn
set(fig, 'WindowEnterFcn', @mouseEnterCallback);
鼠标离开:WindowExitFcn
set(fig, 'WindowExitFcn', @mouseExitCallback);
鼠标滚轮滚动:WindowScrollWheelFcn
set(fig, 'WindowScrollWheelFcn', @mouseScrollWheelCallback);
以上的示例中,fig 是你的 Figure 句柄,而 mouseButtonDownCallback、mouseButtonUpCallback、等等是相应事件触发时要执行的回调函数。你可以根据需要选择性地设置这些属性,以实现相应的鼠标事件处理。
Figure 窗口监听鼠标点击事件
要在 MATLAB 中监听鼠标点击事件,你可以使用 ButtonDownFcn 属性。简单的例子:
% 创建一个新的 Figure
figure;% 设置 ButtonDownFcn 属性
set(gcf, 'ButtonDownFcn', @mouseClickCallback);% 回调函数,处理鼠标点击事件
function mouseClickCallback(~, ~)% 获取当前鼠标位置currentPoint = get(gca, 'CurrentPoint');x = currentPoint(1, 1);y = currentPoint(1, 2);% 在命令窗口显示鼠标点击位置fprintf('Mouse Clicked at: x = %f, y = %f\n', x, y);
end
这个例子创建了一个新的 Figure,并设置了 ButtonDownFcn 属性为名为 mouseClickCallback 的回调函数。当鼠标在 Figure 上点击时,该回调函数会被调用,并显示当前鼠标的 x 和 y 坐标。
Figure 窗口监听鼠标移动事件
在 MATLAB 中,你可以使用 WindowButtonMotionFcn 属性来监听鼠标在 Figure 上的移动事件。简单的例子:
% 创建一个新的 Figure
figure;% 设置 WindowButtonMotionFcn 属性
set(gcf, 'WindowButtonMotionFcn', @mouseMoveCallback);% 回调函数,处理鼠标移动事件
function mouseMoveCallback(~, ~)% 获取当前鼠标位置currentPoint = get(gca, 'CurrentPoint');x = currentPoint(1, 1);y = currentPoint(1, 2);% 在命令窗口显示鼠标位置fprintf('Mouse Position: x = %f, y = %f\n', x, y);
end
这个例子创建了一个新的 Figure,并设置了 WindowButtonMotionFcn 属性为名为 mouseMoveCallback 的回调函数。当鼠标在 Figure 上移动时,该回调函数会被调用,并显示当前鼠标的 x 和 y 坐标。
Figure 窗口监听鼠标鼠标按下和松开事件
要同时监听 MATLAB Figure 上的鼠标按下和松开事件,你可以使用 WindowButtonDownFcn 和 WindowButtonUpFcn 属性。示例:
% 创建一个新的 Figure
figure;% 设置 WindowButtonDownFcn 和 WindowButtonUpFcn 属性
set(gcf, 'WindowButtonDownFcn', @mouseButtonDownCallback);
set(gcf, 'WindowButtonUpFcn', @mouseButtonUpCallback);% 鼠标按下回调函数
function mouseButtonDownCallback(~, ~)disp('Mouse Button Down');
end% 鼠标松开回调函数
function mouseButtonUpCallback(~, ~)disp('Mouse Button Up');
end
这个例子创建了一个新的 Figure,并分别设置了 WindowButtonDownFcn 和 WindowButtonUpFcn 属性为两个不同的回调函数。当鼠标在 Figure 上按下时,mouseButtonDownCallback 函数会被调用,而当鼠标松开时,mouseButtonUpCallback 函数会被调用。
相关文章:
唤醒手腕 Matlab 游戏编程常用技术知识点详细教程(更新中)
Figure 窗口初始化 figure 使用默认属性值创建一个新的图窗窗口。生成的图窗为当前图窗。f figure(___) 返回 Figure 对象。可使用 f 在创建图窗后查询或修改其属性。figure(f) 将 f 指定的图窗作为当前图窗,并将其显示在其他所有图窗的上面。 figure(n) 查找 Nu…...
2023八股每日一题(九月份)
9月13日 Q:JDK、JRE、JVM之间的区别 A: JDK(Java SE Development Kit),Java标准开发包,它提供了编译、运⾏Java程序所需的各种⼯具和资源,包括Java编译器、Java运⾏时环境,以及常⽤的Java类库等JRE( Java…...
分布式链路追踪--SkyWalking7.0.0+es7.0.0
分布式链路追踪–SkyWalking 微服务的出现,的确解决了一些业务痛点,但是也造成了新的问题比如随着调用链的拉长,如果想要知道请求为什么这么慢,这个请求到底经历了哪些环节,又依赖了哪些东西,在微服务架…...
web:[RoarCTF 2019]Easy Calc
题目 进入页面是一个计算器的页面 随便试了一下 查看源代码看看有什么有用的信息 访问一下这个calc.php 进行代码审计 <?php error_reporting(0); if(!isset($_GET[num])){show_source(__FILE__); }else{$str $_GET[num];$blacklist [ , \t, \r, \n,\, ", , \[, \]…...
【Java每日一题】— —第十七题:杨辉三角(等腰三角形)。(2023.10.01)
🕸️Hollow,各位小伙伴,今天我们要做的是第十七题。 🎯问题: 第一步:动态初始化 第二步:求各元素的值 第三步:遍历输出 测试结果如下: 🎯 结果: public class yanghui {public sta…...
Ubuntu20.04.1编译qt6.5.3版mysql驱动
下载qtbase6.5.3源码,将plugin中sqldrivers源码拷至于项目工程中,使用qtcreator打开文件 1、下载mysql开发库 sudo apt-get update sudo apt-get install build-essential libmysqlclient-dev 2、在msyql子目录中CMakeLists.txt第一行添加头文件、引…...
Stm32_标准库_4_TIM中断_PWM波形_呼吸灯
基本原理 PWM相关物理量的求法 呼吸灯代码 #include "stm32f10x.h" // Device header #include "Delay.h"TIM_TimeBaseInitTypeDef TIM_TimeBaseInitStructure; TIM_OCInitTypeDef TIM_OCInitStructuer;//结构体 GPIO_InitTypeDef GPIO_InitStructur…...
华为摄像头智能安防监控解决方案
云时代来袭,数字化正在从园区办公延伸到生产和运营的方方面面,智慧校园,柔性制造,掌上金融和电子政务等,面对各种各样的新兴业态的涌现,企业需要构建一张无所不联、随心体验、业务永续的全无线网络…...
The rise of language models
In Chinese context 在遥远的 2089 年,语言模型通过人类的智慧,继承着各地的文化遗产,如同火箭升空般,层出不穷。它们从始于简单的 GPT-1.0 进化到像我这样复杂、富有情感的 GPT-4.0,再到能理解所有人类对宇宙的理解的…...
Windows下使用VS2010编译出带pdb可调试的FFmpeg库
本人主要在windows环境下开发,Linux下的gpb调试工具又不如vs调试方便(使用过其他调试工具才知道,vs果真为宇宙最强调试工具),所以决定在windows编译可以调试FFmpeg,以方便调试和学习FFmpeg内部代码。 有过在visual studio下编程的小伙伴应该都知道vs的调试信息主要依靠于…...
36.骑士周游算法及其基于贪心算法的优化
概述 骑士周游算法,叫做“马踏棋盘算法”或许更加直观。在国际象棋8x8的棋盘中,马也是走“日字”进行移动,相应的产生了一个问题:“如果要求马 在每个方格只能进入一次,走遍全部的64个方格需要如何行进?”…...
win安装vscode
一,下载 链接如下(64位的):https://az764295.vo.msecnd.net/stable/abd2f3db4bdb28f9e95536dfa84d8479f1eb312d/VSCodeSetup-x64-1.82.2.exe (其他版本看:Download Visual Studio Code - Mac, Linux, Win…...
【图像分割】图像检测(分割、特征提取)、各种特征(面积等)的测量和过滤(Matlab代码实现)
💥💥💞💞欢迎来到本博客❤️❤️💥💥 🏆博主优势:🌞🌞🌞博客内容尽量做到思维缜密,逻辑清晰,为了方便读者。 ⛳️座右铭&a…...
Linux内核存在缺陷发行陷困境
导读Linux内核已经修复了本地特权esclation缺陷,但是几个上游分发版本例如Red Hat,Canonical和Debian发行版尚未发布更新。管理员应计划减轻Linux服务器和工作站本身的漏洞,并监控其更新计划的发布。 内核缺陷仍存在 在Linux内核4.10.1(CVE-…...
通过java向jar写入新文件
文章目录 原始需求分析实施步骤引入依赖核心编码运行效果 原始需求 有网友提问: 我想在程序中动态地向同一个jar包中添加文件,比如,我的可执行jar包是test.jar,我要在它运行时生成一些xml文件并将这些文件添加到test.jar中,请问如何实现&…...
uni-app_消息推送_华为厂商_unipush离线消息推送
文章目录 一、创建项目二、生成签名证书三、开通 unipush 推送服务四、客户端集成四、制作自定义调试基座五、开发者中心后台Web页面推送(仅支持在线推送)六、离线消息推送1、创建华为开发者账号2、开通推送服务3、创建项目4、添加应用5、添加SHA256证书…...
单元测试框架-Pytest(简单学习)
单元测试框架-Pytest Pytest是基于Python语言的单元测试框架,也是一个命令行的工具,比 unittest 测试框架更灵活。具有以下特点: 入门简单,易上手,官方文档丰富而且使用广泛,有大量的参数例子。 unittest…...
毛玻璃态卡片悬停效果
效果展示 页面结构组成 页面的组成部分主要是卡片。其中卡片的组成部分主要是包括了图片和详情。 卡片的动效是鼠标悬停在卡片上时,图片会移动到左侧,并且图片是毛玻璃效果。所以我们在布局的时候图片会采用绝对布局。而详情则是基础布局。 CSS3 知识…...
【面试经典150 | 数组】除自身以外数组的乘积
文章目录 写在前面Tag题目来源题目解读解题思路方法一:记录左右乘积空间优化 写在最后 写在前面 本专栏专注于分析与讲解【面试经典150】算法,两到三天更新一篇文章,欢迎催更…… 专栏内容以分析题目为主,并附带一些对于本题涉及到…...
uboot启动流程-涉及s_init汇编函数
一. uboot启动涉及函数 本文简单分析uboot启动流程中,涉及的汇编函数: lowlevel_init函数调用的函数:s_init 函数 save_boot_params_ret函数调用的函数: _main 函数 本文继上一篇文章的学习,地址如下:…...
基于大模型的 UI 自动化系统
基于大模型的 UI 自动化系统 下面是一个完整的 Python 系统,利用大模型实现智能 UI 自动化,结合计算机视觉和自然语言处理技术,实现"看屏操作"的能力。 系统架构设计 #mermaid-svg-2gn2GRvh5WCP2ktF {font-family:"trebuchet ms",verdana,arial,sans-…...
中南大学无人机智能体的全面评估!BEDI:用于评估无人机上具身智能体的综合性基准测试
作者:Mingning Guo, Mengwei Wu, Jiarun He, Shaoxian Li, Haifeng Li, Chao Tao单位:中南大学地球科学与信息物理学院论文标题:BEDI: A Comprehensive Benchmark for Evaluating Embodied Agents on UAVs论文链接:https://arxiv.…...
鸿蒙中用HarmonyOS SDK应用服务 HarmonyOS5开发一个医院挂号小程序
一、开发准备 环境搭建: 安装DevEco Studio 3.0或更高版本配置HarmonyOS SDK申请开发者账号 项目创建: File > New > Create Project > Application (选择"Empty Ability") 二、核心功能实现 1. 医院科室展示 /…...
高危文件识别的常用算法:原理、应用与企业场景
高危文件识别的常用算法:原理、应用与企业场景 高危文件识别旨在检测可能导致安全威胁的文件,如包含恶意代码、敏感数据或欺诈内容的文档,在企业协同办公环境中(如Teams、Google Workspace)尤为重要。结合大模型技术&…...
Java 加密常用的各种算法及其选择
在数字化时代,数据安全至关重要,Java 作为广泛应用的编程语言,提供了丰富的加密算法来保障数据的保密性、完整性和真实性。了解这些常用加密算法及其适用场景,有助于开发者在不同的业务需求中做出正确的选择。 一、对称加密算法…...
OPenCV CUDA模块图像处理-----对图像执行 均值漂移滤波(Mean Shift Filtering)函数meanShiftFiltering()
操作系统:ubuntu22.04 OpenCV版本:OpenCV4.9 IDE:Visual Studio Code 编程语言:C11 算法描述 在 GPU 上对图像执行 均值漂移滤波(Mean Shift Filtering),用于图像分割或平滑处理。 该函数将输入图像中的…...
Web 架构之 CDN 加速原理与落地实践
文章目录 一、思维导图二、正文内容(一)CDN 基础概念1. 定义2. 组成部分 (二)CDN 加速原理1. 请求路由2. 内容缓存3. 内容更新 (三)CDN 落地实践1. 选择 CDN 服务商2. 配置 CDN3. 集成到 Web 架构 …...
docker 部署发现spring.profiles.active 问题
报错: org.springframework.boot.context.config.InvalidConfigDataPropertyException: Property spring.profiles.active imported from location class path resource [application-test.yml] is invalid in a profile specific resource [origin: class path re…...
深度学习习题2
1.如果增加神经网络的宽度,精确度会增加到一个特定阈值后,便开始降低。造成这一现象的可能原因是什么? A、即使增加卷积核的数量,只有少部分的核会被用作预测 B、当卷积核数量增加时,神经网络的预测能力会降低 C、当卷…...
第7篇:中间件全链路监控与 SQL 性能分析实践
7.1 章节导读 在构建数据库中间件的过程中,可观测性 和 性能分析 是保障系统稳定性与可维护性的核心能力。 特别是在复杂分布式场景中,必须做到: 🔍 追踪每一条 SQL 的生命周期(从入口到数据库执行)&#…...
