matlab基本指令
基本命令
close all //关闭所有figure 命令打开的窗口,在命令窗口输入
clear all //清除之前运行程序所存下的所有变量
size(mat)
a = [1 2 3 ; 4 5 6 ]
size(a) = [2 3] //size(mat) = [rownum, colnum]
delete certain col in mtrix
A = [1 2 3 ; 4 5 6 ; 7 8 9];
A(:, 3) = [];
reshape array
z = reshape(preds(3,:,:),14,177); //it will reduce demension of preds to 14X177
A = [1 2; 3 4]; permute(A,[2 1]) %%convert div 2 with div 1.
ans =
1 3
2 4
cat %%merge matrix A ,B to a new matrix, extend div possibly
heatmap = cat(4,heatmap,hm)
矩阵连接
[s1 s2] %%右侧连接
[s1; s2] %%下侧连接
convert num to string
num2str
convert a cell struct to mat type
cell2mat
waitforbuttonpress: you can put it into for loop
subs = regexp(string, 'c', 'split'); %%将string以'c'为分隔符分割为若干子串并保存至subs中
%%注意:subs是一个cell型数据,其每个元素是cell型的,只能display,不能直接进行字符串操作(如截取或者连接),这时需要字符转换:如,s1=char(subs(1))
画图
hist(x); %%show the 2-D array x' hist
mesh(Z) %%plot 3D figure, where Z is f(m ,n).
I = imgaussfilt(I, 'FilterSize', 11); %%I is image, 11 is size of filter size
连接图
plot(y) //默认x坐标为正整数
plot(x, y)
hold on //表示下次画图基于本图
散点图
scatter(x, y) //以x,y为横纵坐标画散点
scatter(x, y, ‘filled’) 也可以改为 ‘rx’ //即以不同元素表示散点
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律