Reputation: 1239
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 this 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!
Upvotes: 1
Views: 18844
Reputation: 300
Call it this way:
s3()
rather than
s3.m
because it's a function you have created.
Upvotes: 5