博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
matlab基本指令
阅读量:4571 次
发布时间:2019-06-08

本文共 1303 字,大约阅读时间需要 4 分钟。

基本命令

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 possiblyheatmap = 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’     //即以不同元素表示散点

转载于:https://www.cnblogs.com/fariver/p/6500819.html

你可能感兴趣的文章
面向对象(五)
查看>>
android平台下使用点九PNG技术
查看>>
Python学习3,列表
查看>>
最长回文子串
查看>>
JAVA基础-JDBC(一)
查看>>
js中for和while运行速度比较
查看>>
算法第5章作业
查看>>
7.9 练习
查看>>
基于ArcGIS JS API的在线专题地图实现
查看>>
learnByWork
查看>>
lua 函数
查看>>
Git的基本命令
查看>>
四平方和
查看>>
第十八周 12.27-1.2
查看>>
C# IP地址字符串和数值转换
查看>>
TCHAR和CHAR类型的互转
查看>>
常用界面布局
查看>>
C语言—— for 循环
查看>>
IBM lotus9.0测试版即将公测
查看>>
xml常用方法
查看>>