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

Thread Subject:
Problem with RUN while calling a script

Subject: Problem with RUN while calling a script

From: Félix B-Audet

Date: 5 Apr, 2013 16:51:06

Message: 1 of 4

Hi,

I am using a .m script as a scenario's parameters definition file and I want to call it inside a function. I define the script file name and path trough the function uigetfile and then call the script as following:

[FileName, PathName]=uigetfile({'*.m', 'M-files (*.m)'}, 'Pick a scenario file');
CompletePath=fullfile(PathName, FileName);
run(CompletePath);
The first time I call the function, there is no problem, but when I call it for the second time, I get the error:

??? Error using ==> run at 56
Incorrect number of right hand side elements in dot name assignment. Missing [] around left hand side is a likely cause.
The only solution I have now is to restart Matlab. It will then work a single time again.

Thank you for your help

Felix

Subject: Problem with RUN while calling a script

From: Steven_Lord

Date: 5 Apr, 2013 17:30:41

Message: 2 of 4



"Flix B-Audet" <bisf@hotmail.com> wrote in message
news:kjmvdq$k0j$1@newscl01ah.mathworks.com...
> Hi,
>
> I am using a .m script as a scenario's parameters definition file and I
> want to call it inside a function. I define the script file name and path
> trough the function uigetfile and then call the script as following:
>
> [FileName, PathName]=uigetfile({'*.m', 'M-files (*.m)'}, 'Pick a scenario
> file');
> CompletePath=fullfile(PathName, FileName);
> run(CompletePath);
> The first time I call the function, there is no problem, but when I call
> it for the second time, I get the error:
>
> ??? Error using ==> run at 56
> Incorrect number of right hand side elements in dot name assignment.
> Missing [] around left hand side is a likely cause.
> The only solution I have now is to restart Matlab. It will then work a
> single time again.

It's impossible to say for certain without more information, but my guess is
that the parameter definition file creates a function file that has the same
name as one of the functions called by RUN on line 56? Or perhaps you have
your own run.m that's taking precedence over the one included with MATLAB
and that's causing a problem?

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: Problem with RUN while calling a script

From: Félix B-Audet

Date: 5 Apr, 2013 18:31:07

Message: 3 of 4

"Steven_Lord" <slord@mathworks.com> wrote in message <kjn1o1$s54$1@newscl01ah.mathworks.com>...
>
>
> "Flix B-Audet" <bisf@hotmail.com> wrote in message
> news:kjmvdq$k0j$1@newscl01ah.mathworks.com...
> > Hi,
> >
> > I am using a .m script as a scenario's parameters definition file and I
> > want to call it inside a function. I define the script file name and path
> > trough the function uigetfile and then call the script as following:
> >
> > [FileName, PathName]=uigetfile({'*.m', 'M-files (*.m)'}, 'Pick a scenario
> > file');
> > CompletePath=fullfile(PathName, FileName);
> > run(CompletePath);
> > The first time I call the function, there is no problem, but when I call
> > it for the second time, I get the error:
> >
> > ??? Error using ==> run at 56
> > Incorrect number of right hand side elements in dot name assignment.
> > Missing [] around left hand side is a likely cause.
> > The only solution I have now is to restart Matlab. It will then work a
> > single time again.
>
> It's impossible to say for certain without more information, but my guess is
> that the parameter definition file creates a function file that has the same
> name as one of the functions called by RUN on line 56? Or perhaps you have
> your own run.m that's taking precedence over the one included with MATLAB
> and that's causing a problem?
>
> --
> Steve Lord
> slord@mathworks.com
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com

Hi Steve,

Thank you for your help even if I do not understand your answer completely.

First, the definition file does not create anything. All it does is set the workspace variables. It is precisely the file called by RUN on line 56.

Secondly, I checked with the function WHICH and I do not have another RUN function neither as EVALIN.

Finally I compared the workspaces of a successful call with a non-successful call and they are identical. The only solution I have at the moment is to restart Matlab every time.

Thanks again

Félix

Subject: Problem with RUN while calling a script

From: Félix B-Audet

Date: 5 Apr, 2013 18:42:06

Message: 4 of 4

I found a solution. I changed the command line in RUN.m at line 56.

The original command is:
       evalin('caller',[s ';'],'cd(cur);error(lasterr)')

Changing it by the following results in not raising a error and does what I expect it to do.
      evalin('caller',[s ';'],'cd(cur);')

I will do a save as, rename it and keep the two versions of the file in my path.

Thank you.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us