Error in a line
3 次查看(过去 30 天)
显示 更早的评论
Hi everybody, I'm creating a new function but I have problems with the following code:
function I= ind(passo, MATRICE, stato, numero_simulazione)
if MATRICE(numero_simulazione, passo)==stato
I=1;
else
I=0;
end
end
Could you help me please? Thank you
4 个评论
Walter Roberson
2013-6-21
Did it tell you that function definitions were not permitted in that context? Did it tell you that array indices must be non-positive integers? Did it tell you that an input argument was not defined?
回答(1 个)
Walter Roberson
2013-6-21
In order to run that function, you must start it from the MATLAB command line, and you must provide all the relevant arguments in that command. For example,
ACAD>> ind(5, floor(10*rand(15,17)), 2, 11)
You cannot start this function by just pressing F5 or clicking "Run" in the menus.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!