开发者

Attempt to reference field of non-structure array

开发者 https://www.devze.com 2023-02-02 02:19 出处:网络
Can anyone tell me why the following code function s3() function ret = fun(x) disp(x); ret = 0; end fun(1);

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消