matlab是大三学期《大数据挖掘》这门课需要学习的一个软件,此软件功能强大,使用也复杂多样,使用博客记录一些知识点和使用思想,以便更好地进步。
常用小知识:
分号:不显示运算结果
magic(n):生成n阶的矩阵 #魔幻
Array concatenation——cat(n,A,B):把两个矩阵拼接起来,n的取值为拼接方式。“1”为column、“2”为row,“3”为layer
reshape(A,n1,n2):改变矩阵的阶值,如可以把22阶矩阵改变为14阶矩阵。
File Access
①save workspace data to a file:
save name.mat X X为需要保存的变量名称
save name.mat -ascii X 改变编码格式,在文件中可显示
②load data stored in a file:
load(’name.mat’)
load('name.mat','ascii')
Excle File Reading
①Score=xlsread(‘Filename’,’B2:D3’) 第二个参数代表读取的范围,无第二个参数代表取钱全部数字内容
[Score Header]= xlsread(‘Filename’,’B2:D3’) Score返回数字,Header返回String
②xlswrite(‘Filename’,content,fileNumber,‘B2:D3’) 第二个参数为写入内容,第三个参数为写入到第几个表
Low-leval File I/O Function
fid=fopen(‘FileName’,’[permission]’) permission:’r’,’r+’,’W’,’W+’,’a’,’a+’
feof(fid) 判断文件是否读取完毕
fscanf(fid,’format’,size) 读取:size为尺寸可取1、2 ……
fprintf(fid,’format’,content) 写入:format:%d,%f
Drawing
使用同一种模型函数时结果不会被覆盖1
2
3
4>> hold on
>> plot(sin(0:pi/10:2*pi))
>> plot(cos(0:pi/10:2*pi))
>> hold off
在图像中显示表达式:text(x,y,str,’Interpreter’,’later’) 后面两个参数固定
更多详细参考资料请到百度云地址下载PPT,密码:rqwx
最后更新: 2019年08月22日 15:21