Can anyone tell me why the following code
function s3()
function ret = fun(x)
disp(x);
ret = 0;
end
fun(1);
end
produces "Attempt to reference field of non-structure array.". I have t开发者_运维问答his code in a file called s3.m. If I run this in the editor using the play button it runs fine. If I enter s3.m on the command line it produces the above error. Thanks for any help in advance!
Call it this way:
s3()
rather than
s3.m
because it's a function you have created.
精彩评论