在Matlab中使用rand函数时出错 [英] error using rand function in matlab
本文介绍了在Matlab中使用rand函数时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在运行以下代码段Matlab代码时
while running following snippet matlab code
file_name=''B.bmp'';
key=double(imread(file_name))./256;
rand(''state'',key);
matlab抛出以下错误:
following error was thrown by matlab:
??? Error using ==> rand
State must be a double scalar.
谁能帮我解决这个问题,我是Matlab的新手.
can anyone please help me on this i am new to matlab.
推荐答案
在这里进行解释:
http://www.mathworks.com/help/techdoc/math/brnuahp.html [ ^ ],
http://www.mathworks.com/help/techdoc/math/bruv81b.html [ ^ ].
您做的事情很奇怪:您传递的是字符串"state",而不是传递两个整数(请参见上面引用的页面的第二个示例).我什至无法想象你是什么意思……:-)
—SA
This is explained here:
http://www.mathworks.com/help/techdoc/math/brnuahp.html[^],
http://www.mathworks.com/help/techdoc/math/bruv81b.html[^].
You are doing something weird: instead of passing two integers (please see the second of the pages referenced above, with samples), you pass the string ''state''. I cannot even imagine what did you mean by that… :-)
—SA
这篇关于在Matlab中使用rand函数时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文