matlab怎么用问题

(window.slotbydup = window.slotbydup || []).push({
id: '4540180',
container: s,
size: '250,200',
display: 'inlay-fix'
热门资料排行
添加成功至
资料评价:
所需积分:0小木虫 --- 700万学术达人喜爱的学术科研平台
热门搜索:
&&matlab一运行就出现的问题
matlab一运行就出现的问题
之前用的挺好的,现在一运行,就出现这样的错误,实在不知道怎么办了,百度了,也没解决,好像也没什么办法,电脑重启了,软件也重装了,就是没有效果,希望知道的大神给指点一下,谢谢啊
-----------------------------------------------------------------------
& && & Segmentation violation detected at Fri Nov 08 09:05:26 2013
------------------------------------------------------------------------
Configuration:
&&MATLAB Version:& &7.0.0.19920 (R14)
&&Operating Sys: Microsoft Windows XP
&&Window Sys:& & Version 5.1 (Build 2600: Service Pack 3)
&&Processor ID:& &&&x86 Family 6 Model 15 Stepping 13, GenuineIntel
&&Virtual Machine:&&Java 1.4.2 with Sun Microsyss Inc. Java HotSpot(TM) Client VM
& & (mixed mode)
&&Default Charset:&&ibm-02
Register State:
&&EAX = 2830dc00&&EBX = 00cddd74
&&ECX = 282df9d8&&EDX =
&&ESI = &&EDI = 014ebb60
&&EBP = 00cddd14&&ESP = 00cddd04
&&EIP = &&FLG =
Stack Trace:
& &libmwgui.dll:void __cdecl wm_ShowWindow(struct WinRec_tag *)(0xxx00cde09c, 1) + 30 bytes
& &hg.dll:void __cdecl set_root_CurrentFigure(struct GObject_tag *,struct GObject_tag *)(0x014ebb60, 0xxxffffffff) + 302 bytes
& &hg.dll:_hgFigure(0, 0x00cde03c, 1, 0x00cde09c) + 205 bytes
& &m_dispatcher.dll:public: virtual void __thiscall Mfh_builtin&struct mxArray_tag&::dispatch_mf(int,struct mxArray_tag * *,int,struct mxArray_tag * *)(0, 0x00cde03c, 1, 0x00cde09c) + 55 bytes
& &m_dispatcher.dll:public: virtual void __thiscall Mfh_MATLAB_fn::dispatch_fh(int,struct mxArray_tag * *,int,struct mxArray_tag * *)(0, 0x00cde03c, 1, 0x00cde09c) + 200 bytes
& &m_interpreter.dll:_inDispatchFromStack(166, 0x014bde73 &figure&, 0, 1) + 891 bytes
& &m_interpreter.dll:_inCallFcnFromReference(0, 0x28be50e0, 0x789b59c0, 0xcccccccd) + 176 bytes
& &m_interpreter.dll:int __cdecl inInterp(enum inDebugCheck,int,int,enum opcodes,struct inPcodeNest_tag volatile *)(1, 0, 130, 0) + 4115 bytes
& &m_interpreter.dll:int __cdecl inInterPcodeSJ(enum inDebugCheck,int,int,enum opcodes,struct inPcodeNest_tag *)(1, 0, 3, 0) + 272 bytes
& &m_interpreter.dll:int __cdecl inExecuFunctionOrScript(class Mfh_mp *,bool)(0x27e6d150, 1, 0, 0x27e6d150) + 773 bytes
& &m_interpreter.dll:_inExecCompScript(0, 0x00cde71c, 0x27e6d150, 0xffffffff) + 321 bytes
& &m_interpreter.dll:public: void __thiscall Mfh_mp::inRunMP(int,struct mxArray_tag * *,int,struct mxArray_tag * *,struct inWorkSpace_tag *)(0, 0x00cde71c, 0, 0x00cde77c) + 122 bytes
& &m_interpreter.dll:public: virtual void __thiscall Mfh_mp::dispatch_file(struct _mdUnknown_workspace *,int,struct mxArray_tag * *,int,struct mxArray_tag * *)(0, 0, 0x00cde71c, 0) + 28 bytes
& &m_interpreter.dll:public: virtual void __thiscall Mfh_mp::dispatch_file(int,struct mxArray_tag * *,int,struct mxArray_tag * *)(0, 0x00cde71c, 0, 0x00cde77c) + 26 bytes
& &m_dispatcher.dll:public: virtual void __thiscall Mfh_file::dispatch_fh(int,struct mxArray_tag * *,int,struct mxArray_tag * *)(0, 0x00cde71c, 0, 0x00cde77c) + 273 bytes
& &m_interpreter.dll:_inDispatchFromStack(777, 0x2fe4c204 &laping&, 0, 0) + 891 bytes
& &m_interpreter.dll:enum opcodes __cdecl inDispatchCall(char const *,int,int,int,int *,int *)(0x2fe4c204 &laping&, 777, 0, 0) + 111 bytes
& &m_interpreter.dll:int __cdecl inInterp(enum inDebugCheck,int,int,enum opcodes,struct inPcodeNest_tag volatile *)(2, 0, 0, 0) + 2411 bytes
& &m_interpreter.dll:int __cdecl inInterPcodeSJ(enum inDebugCheck,int,int,enum opcodes,struct inPcodeNest_tag *)(2, 0, 0, 0) + 272 bytes
& &m_interpreter.dll:_inInterPcode(2, 0x, 0, 0) + 69 bytes
& &m_interpreter.dll:enum inExecutionStatus __cdecl in_local_call_eval_function(int *,struct _pcodeheader *,int *,struct mxArray_tag * * const,enum inDebugCheck)(0x00cdf2c8, 0x00cdf3bc, 2, 0x0fd6ffe0 &laping\n&) + 162 bytes
& &m_interpreter.dll:$L6f2d8, 0x0fd6ffe0 &laping\n&, 7, 0) + 196 bytes
& &m_interpreter.dll:enum inExecutionStatus __cdecl inEvalCmdWithLocalReturnandtype(char const *,int *,enum inDebugCheck)(0, 2, 1, 0x00cdf44c &趑�) + 86 bytes
& &m_interpreter.dll:_inEvalCmdNoEnd(0x0fd6ffe0 &laping\n&, 0x00cdf4e4, 0x00cdf4a0, 0x014c1fd0) + 16 bytes
& &bridge.dll:_mnParser(0x7c80b741, 0x014c1fd0, 0, 0) + 431 bytes
& &mcr.dll:public: void __thiscall mcrInstance::mnParser(void)(x4d5c3a43, 0x414cc3742) + 87 bytes
& &MATLAB.exe:0x9c1fd0)
& &MATLAB.exe:0xx022f72b0, 0xx7ffdd000, 0x8054c6ed)
& &kernel32.dll:0x7c803cc0 &jth(U@&, 0, 0, 0)
Please follow these steps in reporting this problem to The MathWorks so
that we have the best chance of correcting it:
&&1. Send this crash report to
for automated analysis.
& &&&For your convenience, this information has been recorded in:
& && & C:\DOCUME~1\my\LOCALS~1\p\matlab_crash_dump.3676
&&2. Also, if the problem is roducible, send the crash report to
& &&& along with:
& && & - A specific list of steps that will roduce the problem
& && & - Any M, MEX, MDL or other files required to roduce the problem
& && & - Any error messages displayed to the command window
& &&&A technical support engineer will contact you with further information.
Thank you for your assistance.&&Please save your workspace and restart
MATLAB before continuing your work.
Error in ==& text at 130
figure(1);
嗯嗯,谢谢哦,刚刚给同学要了一个2012b版本的,装了半天了,还是有问题,:cry::cry:,给你留个邮箱吧,有空发给俺吧。。。非常感谢,好人一生平安:D
非常感谢,这次决定重装了,实在是头大了,。。。我会认真看的,谢谢你。。。金币暂时撒没了,送你一朵小红花吧,祝好运~,
没有装过呢,,,几天不用了,现在又好了:D
学术必备与600万学术达人在线互动!
扫描下载送金币相关文章推荐
先下载libsvm,
libsvm库下载:http://www.csie.ntu.edu.tw/~cjlin/libsvm/
matlab安装libsvm需要C语言编辑器,...
matlab带UI界面编译成可执行文件问题汇总
逛论坛,发现很多朋友安装MATLAB时,都或多或少的遇到一些问题。但是,我发现很多问题都是大家遇到的,所以呢,为了帮助大家,我上网搜集,总结了一下十几种安装错误提示以及解决方案,供大家参考。也许有些解...
1.计算程序运行时间
....程序段
matlab许可证到期,一直显示要激活
建立一个license.lic的文件,把下面的代码粘贴到文件里面,然后放到MATLAB根目录的license文件夹里替换原来的li...
他的最新文章
讲师:董晓杰
讲师:姚远
他的热门文章
您举报文章:
举报原因:
原文地址:
原因补充:
(最多只允许输入30个字)matlab学习中遇到的问题整理
编程基础实在是很差,将最近在看matlab程序遇到的问题查资料,并整理如下:
一.Matlab输出输出参数varargout与nargout,varargin与nargin的区别(来自百度文库)
1、varargout与nargout区别&&&
varargout简介:&
varargout可以看做“Variable length output argument
list”的缩写。在matlab中定义m函数时通过varargout我们可以得到可变的数个返回值。在matlab命令窗口中输入doc
varargout或help
varargout可以获得相关帮助信息。函数申明时的输出参数。&&
用法:function varargout = foo(n)。&&
nargout简介:&&
在matlab中定义一个函数时,在函数体内部,nargout指出了输出参数的个数。特别是在利用了可变参数列表的函数中,用nargout获取输出参数个数很方便。&&
用法:&& n =
nargout&&&&
nargout(fun)&&&&
2、varargin与nargin的区别&&
varargin简介:&
varargin可以看做“Variable length input argument list”的缩写。在matlab中,
varargin提供了一种函数可变参数列表机制。就是说,使用了“可变参数列表机制”的函数允许调用者调用该函数时根据需要来改变输入参数的个数。&&
用法:function y =
bar(varargin)。&&
nargin简介:&&
在matlab中定义一个函数时,在函数体内部,nargin指出了输入参数的个数。特别是在利用了可变参数列表的函数中,用nargin获取输入参数个数很方便。
nargin是用来判断输入变量个数的函数,这样就可以针对不同的情况执行不同的功能。通常可以用它来设定一些默认值。&&用法:
nargin&&&&
n = nargin(fun)&&
&3、实例&&
function& varargout =
foo(varargin)&&
fprintf('How many output arguments? %d\nAnd they are: \n',
nargout);&
for k=1:nargout&&
&& varargout(k) = varargin(k);
% the same as {varargin{k}};&
&& fprintf('%s ',
num2str(varargout{k}));&
在matlab command中运行结果如下:&&
&&[y1,y2]=lianxi(1,2,3)&&&&&
&How many output arguments?
y=lianxi(1,2,3)&&&&&
How many output arguments?
二、eval函数:
eval_r()函数的功能就是将括号内的字符串视为语句并运行
eg:& eval_r('y1=sin(2)')和语句y1=sin(2)等价
多在循环中使用,可以对多个名字有规则的变量或文件进行操作,eg:
eval_r(['y',num2str(x),'=',num2str(x*2),';'])
三、比较两个输入字符串是否相等
用法:c = strcmp(str1,str2)
比较字符串 str1 与 str2 ,若完全相等则返回 1 ,不相等返回 0
str1 = 'map';
str2 = 'make';
c = strcmp(str1,str2)
matlab处理结果:c =0
四、Matlab的基本数据类型
(来自百度文库& )
Matlab中有15种基本数据类型,主要是整型、浮点、逻辑、字符、日期和时间、结构数组、单元格数组以及函数句柄等。&&&&&&&&&
(int8;uint8;int16;uint16;int32;uint32;int64;uint64)通过intmax(class)和intmin(class)
函数返回该类整型的最大值和最小值,例如intmax(&int8‟)=127;&&&&&&&&
(single;double)&
浮点数:REALMAX('double')和REALMAX('single')分别返回双精度浮点和单精度浮点的最大值,REALMIN('double')和REALMIN
('single')分别返回双精度浮点和单精度浮点的最小值。&
3、逻辑:(logical)&
Logical:下例是逻辑索引在矩阵操作中的应用,将5*5矩阵中大于0.5的元素设定为0:&&&&&&&
rand(5);&&&&&&&
A(A&0.5)=0;&
4、字符:(char)&
Matlab中的输入字符需使用单引号。字符串存储为字符数组,每个元素占用一个ASCII字符。如日期字符:DateString=&#/;
实际上是一个1行9列向量。构成矩阵或向量的行字符串长度必须相同。可以使用char函数构建字符数组,使用strcat函数连接字符。&
例如,命令 name = ['abc'& 'abcd']
将触发错误警告,因为两个字符串的长度不等,此时可以通过空字符凑齐如:name = ['abc '&
'abcd'],更简单的办法是使用char函数:char('abc','abcd'),Matlab自动填充空字符以使长度相等,因此字符串矩阵的列纬总是等于最长字符串的字符数.&
例如size(char('abc','abcd'))返回结果[2,4],即字符串‟abc‟实际存在的是‟abc
‟,此时如需提取矩阵中的某一字符元素,需要使用deblank函数移除空格如name =char(&abc‟,‟abcd‟);
deblank(name(1,:))。&
此外,Matlab同时提供一种更灵活的单元格数组方法,使用函数cellstr可以将字符串数组转换为单元格数组:&
char(&abc‟,‟abcd‟)&&&&&&&
length(data(1,:)) -&? 4&
cdata=cellstr(data)&&&&&&&
length(cdata{1}) -&?3& 常用的字符操作函数
返回n个空字符&&&&&&&&
deblank(s)
移除字符串尾部包含的空字符&&&&&&&
将字符串作为命令执行&&&&&&&
findstr(s1,s2)
搜索字符串&&&&&&&
判断是否字符串&&&&&&&&
isletter(s)
判断是否字母&&&&&&&
转换小写&&&&&&&
转换大写&&&&&&&&
strcmp(s1,s2)
比较字符串是否相同&&&&&&&&
strncmp(s1,s2,n)
比较字符串中的前n个字符是否相同&&&&&&&
strrep(s1,s2,s3) 将s1中的字符s2替换为s3&
5、日期和时间&
Matlab提供三种日期格式:日期字符串如&#-02‟,日期序列数如00年1月1日为1)以及日期向量如
0 0 0,依次为年月日时分秒。&
常用的日期操作函数& datestr(d,f)
将日期数字转换为字符串&&&&&&&
datenum(str,f)
将字符串转换为日期数字&&&&&&&
datevec(str)
日期字符串转换向量&&&&&&&
weekday(d)
计算星期数&&&&&&&&
eomday(yr,mth)
计算指定月份最后一天&&&&&&&
calendar(str)
返回日历矩阵&&&&&&&&
clock 当前日期和时间的日期向量& date
当前日期字符串&&&&&&&&
now 当前日期和时间的序列数&
结构是包含已命名“数据容器”或字段的数组。结构中的字段可以包含任何数据。
7、构建结构数组
(1)赋值方法& 下面的赋值命令产生一个名为patient的结构数组,该数组包含三个字段:
patient.name = 'John Doe'; patient.billing =
127.00;& patient.test = [79 75 73; 180 178 177.5;
220 210 205];& 在命令区内输入patient可以查看结构信息: name: 'John
Doe' billing: 127 test: [3x3 double]&
继续赋值可扩展该结构数组: patient(2).name = 'Ann Lane'; patient(2).billing =
28.50;& patient(2).test = [68 70 68; 118 118 119;
172 170 169];& 赋值后结构数组变为[1 2]。
(2)构建结构数组:struct函数&&
函数基本形式为:strArray = struct('field1',val1,'field2',val2,
...)& 例如:& weather(1) =
struct('temp', 72,'rainfall', 0.0); weather(2) = struct('temp',
71,'rainfall',
0.1);&&&&&&&&&
weather = repmat(struct('temp', 72, 'rainfall', 0.0), 1,
3);&&&&&&&&
weather = struct('temp', {68, 80, 72}, 'rainfall', {0.2, 0.4,
(3)访问结构数据& 以下都是合法的结构数组访问命令: mypatients =
patient(1:2) 获取子结构数据 mypatients(1) 访问结构数据&
patient(2).name 访问结构数据中的特定字段& patient(3).test(2,2)
访问结构数据中的特定字段(该字段为数组) bills = [patient.billing]
访问多个结构& tests = {patient(1:2).test}
提取结构数据转换成单元格数组& 使用结构字段的动态名称&
通过structName.(expression_r_r_r)可以赋予结构字段名称并访问数据。例如字段名为expression_r_r_r、结构名为structName,访问其中第7行1至25列数据可以使用命令:structName.(expression_r_r_r)(7,1:25)。&
例如,存在一个学生每周成绩数据结构数组,其数据通过以下方式建立: testscores.wang.week(1:25) =
...&&&&&&&&
[95 89 76 82 79 92 94 92 89 81 75 93
...&&&&&&&&&
85 84 83 86 85 90 82 82 84 79 96 88 98];&
testscores.chen.week(1:25) =
...&&&&&&&&&&&&&&&&&&
[87 80 91 84 99 87 93 87 97 87 82 89
...&&&&&&&&&&&&&&&&&&&
86 82 90 98 75 79 92 84 90 93 84 78 81];&
即结构名为testscores,字段使用每个学生的名称命名,分别为wang和chen,每个学生下面包含名为week的成绩结构数组。&
现计算给定结构名称、学生名称和起止周数的平均分数。 在命令窗口中输入 edit
avgscore.m,输入以下代码后保存文件:& function avg =
avgscore(struct,student, first,
last)&&&&&&&
avg = sum(struct.(student).week(first:last))/(last - first +
1);& 在命名窗口中输入:avgscore(testscores, 'chen', 7, 22)
计算学生陈从第7周到第22周的平均分数。
(4)添加和删除结构字段&
命令[struct](index).(field)可添加或修改字段。如patient(2).ssn = '000-00-0000'
在结构patient中添加一个名为ssn的字段。&
删除字段使用rmfield函数,如patient2 = rmfield(patient, 'name')
删除name字段并产生新的结构。
8、单元格数组:(cell)&
单元格数组提供了不同类型数据的存储机制,可以储存任意类型和任意纬度的数组。 访问单元&
格数组的规则和其他数组相同,区别在于需要使用花括号{}访问,例如A{2,5}访问单元格数组A中的第2行第5列单元格。&&
(1)构建单元格数组:赋值方法& 使用花括号标识可直接创建单元格数组,如: A(1,1) = {[1
4 3; 0 5 8; 7 2
9]};&&&&&&&
{'abcd'};&&&&&&&
{3+7i};&&&&&&&&
A(2,2) = {-pi:pi/10:pi};&
上述命令创建2*2的单元格数组A。继续添加单元格元素直接使用赋值如A(2,3)={5}即可,注意需使用花括号标识。简化的方法是结合使用花括号(单元格数组)和方括号()创建,如C
= {[1 2], [3 4]; [5 6], [7 8]};&
(2)构建单元格数组:函数方法&&
Cell函数。如:& B = cell(2, 3); B(1,3) =
(3)访问数据& 通过索引可直接访问单元格数组中的数据元素,例如: N{1,1} = [1
2; 4 5]; N{1,2} = 'Name'; N{2,1} = 2-4i; N{2,2} = 7; c = N{1,2} d =
N{1,1}(2,2)&
9、函数句柄&
函数句柄是用于间接调用一个函数的Matlab值或数据类型。在调用其它函数时可以传递函数句柄,也可在数据结构中保存函数句柄备用。通过命令形式
fhandle = @functionname 可以创建函数句柄,例如 ,或匿名函数sqr = @(x)
x.^2;。& 使用句柄调用函数的形式是 fhandle(arg1, arg2, ...,
argn) 或 fhandle()(无参数)。如: trigFun(1)。例:& function
x = plotFHandle(fhandle, data) plot(data,
fhandle(data))& plotFHandle(@sin,
-pi:0.01:pi)& 数据类型转换如C语言中的强制类型转换相似e.g.: y=9;
z=double(y);&&&&
Matlab中的图像数据类型转换&
&MATLAB中读入图像的数据类型是uint8,而在矩阵中使用的数据类型是double因此
I2=im2double(I1)
:把图像数组I1转换成double精度类型;如果不转换,在对uint8进行加减时会产生溢出,可能提示的错误为: Function
'*' is not defined for values of class
'uint8'。&&&&&&&&
图像数据类型转换函数&
默认情况下,matlab将图像中的数据存储为double型,即64位浮点数;matlab还支持无符号整型(uint8和uint16);uint型的优势在于节省空间,涉及运算时要转换成double型。&&&&
im2double():将图像数组转换成double精度类型&&&&&
im2uint8():将图像数组转换成unit8类型&&&&&&
im2uint16():将图像数组转换成unit16类型。&&&
五.读取结构体信息的方法(来自百度知道)
1.使用fieldnames()函数查看有哪些成员,eg:
&& a.x1 = 3;
&& a.x2 = 'a cell';
&& a.x3 = [1,2;3,4;5,6];
fieldnames(a)&&&&&&&
% 返回成员名称列表
使用getfield()函数查看成员数据,比如:
getfield(a,'x2')&&&&&&&
% 查看某一成员的值
已投稿到:
以上网友发言只代表其个人观点,不代表新浪网的观点或立场。

我要回帖

更多关于 matlab组合函数 的文章

 

随机推荐