0
votes

I am suffering an error whose identifier is 'MATLAB:TooManyOutputs' in MATLAB 2013a when executing a code that didn't fail in MATLAB 2012b.

The line which produces this error is

handles.Project = project;

where project is a struct (size 1x1) and handles is a struct with the handles of the GUI that I have created. Project is a field of the struct handles which doesn't exist prior to the above line.

What seems very strange to me is that if I put a breakpoint in the line before that which I have shown, I comment it and, when the execution is paused due to that breakpoint, I write manually in the MATLAB command line handles.Project = project; there is no error.

Where may the error be? What's wrong?

Thank you.

EDIT: There is another unexplainable issue. I have found out that this line doesn't crash my program in MATLAB 2013a for UNIX, but it does in MATLAB 2013a for Windows.

EDIT2: I have discovered there is a new function in MATLAB 2013a for Windows which is called project, so I guess MATLAB thinks I am calling it instead of the variable I really want. The problem is I can't change the name of my variable (because it is stored in a MAT-file which is created by another program whose code I don't have access to). So, is there any way to say: "MATLAB, I want you to use this variable rather than your new function"?

1
Could you set a breakpoint to that line and type in which project when it stops there? What is the output? There must be something else named project which is covering the visibility of the struct. - Daniel
@Daniel which project returns: project is a variable. If I write project in the MATLAB command line it shows it is a struct with two fields, which is correct. - baister
@Daniel You're right. Look at my EDIT2 comment, please. - baister
show the part of the code where you load the data from the MAT-file - Amro
you could load the data as D = load([..]) then access the individual variables contained inside the MAT-file as: D.project (no ambiguity there). - Amro

1 Answers

1
votes

If you call the load function with an output argument, the contents of the MAT-file will be returned as a structure, one field per variable. This way you avoid polluting the workspace especially if you have many variables stored in the MAT-file, and avoid possible name clashes.

D = load('some_file.mat');
handles.Project = D.project;