Matlab throws errors even though the script has not been touched

3 views (last 30 days)
I keep having a problem where my script, which is normally fine, decides not to work and throws errors. See below:
??? Error using ==> plus Matrix dimensions must agree.
Error in ==> pls at 421 model.reg = model.reg([1:ny]+(ny*(ncomp-1)),:)';
Error in ==> plsda at 225 model = pls(varargin{:});
Error in ==> PRS_VIEW_PLSDA_LOADINGS_v4ps>DoPLSDA_Callback at 479 MODEL = plsda(AXtic,Call,SetLVsOUT,OPTS);
Error in ==> gui_mainfcn at 96 feval(varargin{:});
Error in ==> PRS_VIEW_PLSDA_LOADINGS_v4ps at 44 gui_mainfcn(gui_State, varargin{:});
Error in ==> guidemfile>@(hObject,eventdata)PRS_VIEW_PLSDA_LOADINGS_v4ps('DoPLSDA_Callback',hObject,eventdata,guidata(hObject))
??? Error while evaluating uicontrol Callback
It resolved itself once without me doing anything, but has now happened again for some unknown reason. Previous version of the script I'm adapting also throw the same errors, even though they have not been changed at all.
Is there a potential issue with Matlab and variables stored in the memory maybe? Or something to do with confusion of functions being used.
Any ideas how to resolve this and prevent it from reoccurring?
  1 Comment
Walter Roberson
Walter Roberson on 2 Jun 2013
At the MATLAB command line give the command
dbstop if error
and run the program. When it stops, examine ny and ncomp: I suspect that you will find that one of them is not a scalar. You could then trace back in the code to figure out why the value is not a scalar.
My suspicion is that you might be running the program on data that is a dimension higher than is expected, such as if you were trying to load 3 dimensional data where 2 dimensional data was expected. It is not uncommon for people to run into that kind of situation if they load in an RGB image where a program expects grayscale.

Sign in to comment.

Answers (0)

Categories

Find more on Graphics Object Programming in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!