MATLAB Answers


Syntax error in mfile, but not incommand window

Asked by Nath
on 30 Jan 2013

I have a custom class RFile that overloads subsref. When I write in the command window RFile('some_file').save('x','y','-v7.3'), it works well without a warning. But when I put that instruction in a .m file and execute it, I got the error

??? Static method or constructor invocations cannot be indexed.
Do not follow the call to the static method or constructor with
any additional indexing or dot references.

Why the command window didnt raise an error in the first time ? Are there any workaround ?


Log in to comment.


No products are associated with this question.

0 Answers

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!