General.
char - Create character array (string).
strings - Help for strings.
cellstr - Create cell array of strings from character array.
blanks - String of blanks.
deblank - Remove trailing blanks.
String tests.
iscellstr - True for cell array of strings.
ischar - True for character array (string).
isspace - True for white space characters.
isstrprop - Check if string elements are of a specified category.
String operations.
regexp - Match regular expression.
regexpi - Match regular expression, ignoring case.
regexprep - Replace string using regular expression.
strcat - Concatenate strings.
strvcat - Vertically concatenate strings.
strcmp - Compare strings.
strncmp - Compare first N characters of strings.
strcmpi - Compare strings ignoring case.
strncmpi - Compare first N characters of strings ignoring case.
strread - Read formatted data from string.
findstr - Find one string within another.
strfind - Find one string within another.
strjust - Justify character array.
strmatch - Find possible matches for string.
strrep - Replace string with another.
strtok - Find token in string.
strtrim - Remove insignificant whitespace.
upper - Convert string to uppercase.
lower - Convert string to lowercase.
Character set conversion.
native2unicode - Convert bytes to Unicode characters.
unicode2native - Convert Unicode characters to bytes.
String to number conversion.
num2str - Convert numbers to a string.
int2str - Convert integer to string.
mat2str - Convert a 2-D matrix to a string in MATLAB syntax.
str2double - Convert string to double precision value.
str2num - Convert string matrix to numeric array.
sprintf - Write formatted data to string.
sscanf - Read string under format control.
Base number conversion.
hex2num - Convert hexadecimal string to double precision number.
hex2dec - Convert hexadecimal string to decimal integer.
dec2hex - Convert decimal integer to hexadecimal string.
bin2dec - Convert binary string to decimal integer.
dec2bin - Convert decimal integer to a binary string.
base2dec - Convert base B string to decimal integer.
dec2base - Convert decimal integer to base B string.
num2hex - Convert singles and doubles to IEEE hexadecimal strings.
自学matlab,最近经常用到的函数,汇总一下。
ezplot/ezplot3:画符号函数的图像
plot/plot3:画图函数
plotyy:画双y座标图像的函数
bar/bar3: 画条形图
barh/bar3h:画横向条形图
pie/pie3:画饼图
meshgrid:让两个矩阵编程相同行列的的一个特殊函数×
strcat:字符串拼接函数
strcmp:字符串比较函数
class:查看变量类型的函数
相关日志
实验室爱好者之家—Labfans.com 以matlab的讨论版为主,但不仅局限于matlab,其他的一些实验室常用软件也有相应的讨论版,包括ANSYS论坛,LabVIEW论坛,Mathematica论坛,MathCAD论坛等等。
Matlab版块是主要,从基本学习,接口与编程,到各专业领域的应用都有,详细列表如下:
MATLAB基础学习
MATLAB接口与混合编程
MATLAB GUI界面
MATLAB图像处理
MATLAB通信与信号处理
MATLAB工具箱与专业算法
MATLAB数学建模 科学计算 工程应用
MATLAB与毕业设计
SIMULINK学习讨论区
MATLAB 综合|RSS聚合测试区
请感兴趣的网友经常去看看!
相关日志
从matlab fans club的bbs看到的好文章,转载一下:
matlab中如何读取TXT数据文件中指定行的数据?
下面这个函数是取filein中的第line行写入fileout中的程序,如果想实现取特定几行,只要稍微修改一下就可以。
function dataout=dataread(filein,fileout,line)
fidin=fopen(filein,’r');
fidout=fopen(fileout,’w');
nline=0;
while ~feof(fidin) % 判断是否为文件末尾
tline=fgetl(fidin); % 从文件读行
nline=nline+1;
if nline==line
fprintf(fidout,’%s\n’,tline);
dataout=tline;
end
end
fclose(fidin);
fclose(fidout);
%%%%%%%%%%%%%%%%%%%%%%%%%%
调用格式:dataout=dataread(filein,fileout,line)
如果你的txt文件数据是矩阵形式的,而没有其它的文字,用下面的程序就可以读任意行任意列的数据
a=textread(’ll.txt’);
t=a(1:43,4:10);
1:43是1到43行,4:10是4到10列的数据,当然也可以只读一个数据,如果你的matlab没有textread函数,直接从mathworks网站下载就行。
相关日志
matlab中提供了几个函数用于字符串的搜索和替换:
strrep函数对字符串进行搜索和替换操作;
findstr函数把子字符串的起始位置返回到所在母字符的位置;
strtok函数在输入字符串中第一个发现间隔符时返回间隔符前面的字符;可用该函数将句子分成单词;
strmatch函数在字符数组或字符串单元数组的整个行中进行查找,看有没有以给定字符序列打头的字符串,它返回以该字符串打头的行号。
%查找替换%
>> label=’honkin is a bloger’;
>>newlabel=strrep(label,’bloger’,'blogger’) ;
newlabel =
honkin is a blogger
%用findstr查找子字符串的位置%
childstr=findstr(’is’,newlabel)
childstr =
8
%将句子分成单词%
all_words=”;
newlabel=’honkin is a blogger!’
while(any(newlabel))
[chopped,newlabel]=strtok(newlabel);
all_words=strvcat(all_words,chopped);
end
newlabel =
honkin is a blogger!
>> all_words
all_words =
honkin
is
a
blogger!
相关日志
Matlab中用int函数求函数的不定积分和定积分,int函数的调用格式如下:
int(F):对F函数的独立变量求不定积分
int(F,v):对v变量求不定积分
int(F,a,b):求函数F求定积分,a,b为上下限
int(F,v,a,b):对v变量求从a到b的定积分
例如:
%求不定积分%
>> f=’x+1′
f =
x+1
>> int(f)
ans =
1/2*x^2+x
%求定积分%
int(f,1,2)
ans =
5/2
%多变量的情况%
>> syms x y
>> F=x+y
F =
x+y
>> int(F,x)
ans =
1/2*x^2+y*x
>> int(F,y)
ans =
y*x+1/2*y^2
>> int(F,y,1,2)
ans =
x+3/2
相关日志
1Matlab中文学习站
. 
最大,最全的matlab中文学习网站,论坛里面有面向各个层次,各个方向的分版块,还有很多视频资料可以免费下载.
2. ![]()
Matlab的官方网站,有大量的资源下载. Blog栏目中有5位专业blogger:
Loren on the Art of MATLAB
Doug’s Pick of the Week
Steve on Image Processing
Inside the MATLAB Desktop
Seth on Simulink
更新中…
欢迎提供资源
相关日志
Matlab的方便之处就在于提供了演算纸方式的计算,只要使用M语言,在matlab的命令窗口就可以实现任意的计算。所以如果想求一个函数的极限值就变得非常容易了,就像在演算纸上写下算式,马上就能得到答案。不过求极限的函数limit一定要会用。
limit函数的格式如下:
limit(F,x,a,’right/left’):表示函数F在x=a处的极限值;
如果缺少a, 则默认为a=0;当x为唯一的变量时可以省略.
如果我们想求一下函数的极限
x - 2
——
2
x - 4
syms x;
>> myf=(x-2)/(x^2-4);
limit(myf)
ans =
1/2
limit(myf,2)
ans =
1/4
limit(myf,x,2,’right’)
ans =
1/4
