impoly crash error in Matlab - matlab

I've recently been developing a GUI, which worked fine until Matlab crashed while running an unrelated code. A section of my code which allows a user to draw a ROI no longer works and reports an error with my impoly call (worked perfectly before Matlab crashed):
function cb(src,evt)
handles = guidata(src); %# import the data from the object
images=handles.images;
start = handles.view_slice;
last = handles.slices;
imshow(images(:,:,start),[])
h=impoly;
position = getPosition(h);
The error I now get is:
Error using hittest
Invalid object handle
Error in imshared.ipthittest (line 33)
h = hittest(hFigure, currentPoint);
Error in findLowestManagedObject (line 14)
hit_obj =
imshared.ipthittest(hFigure,buttonMotionEvent.currentPoint);
Error in iptPointerManager>createPointerManager/updatePointer
(line 334)
overMe =
findLowestManagedObject(hFigure,mouseMotionEvent);
Error in
iptPointerManager>createPointerManager/enablePointerManager (line
259)
updatePointer(figHandle, evt);
Error in iptPointerManager (line 72)
pointerManager.API.enable();
Error in manageInteractivePlacement (line 76)
iptPointerManager(h_fig,'Enable');
Error in impoly>impolyAPI (line 245)
placement_aborted =
manageInteractivePlacement(h_axes,h_group,#placePolygon,#buttonUpPlacement);
Error in impoly (line 97)
[h_group,draw_api] = impolyAPI(varargin{:});
Error in volume_scan>cb (line 288)
h=impoly;
Error while evaluating uitoggletool OnCallback
Apart from this not working, there is other weirdness including text stuck in a table on GUIDE (which I cannot remove) and a checkbox text which keeps defaulting to the 3rd option
Anybody got any ideas? Is there a crash file somewhere that needs to be reset/removed? I'm using 2012b.
Thanks, Jim

Related

How do I export result of visdiff of two models programmatically (Matlab versions <= R2016b)?

I am comparing two models using visdiff. I can see the results as a comparison tab. I see options on the GUI to export results in different format.
How do I export these results programmatically?
I am able to export it for non-model files.
But for model files it throws following error:
Subscript indices must either be real positive integers or logicals.
Error in linediff>tokenize (line 153)
cls = tok_class(double(s));
Error in linediff (line 18)
tok1 = tokenize(line1,ignore_whitespace);
Error in textdiff>i_CreateHTML/writeModifiedLine (line 158)
[newline1,newline2] = linediff(line1,line2,showchars,ignore_whitespace);
Error in textdiff>i_CreateHTML (line 464)
writeModifiedLine(line1,a1(n),line2,a2(n));
Error in textdiff (line 42)
htmlOut=i_CreateHTML(source1,text1,readable1, ...
Error in comparisons_private (line 9)
out = textdiff(varargin{:});
Error in visdiff (line 52)
htmlOut = comparisons_private('textdiff',filename1,filename2,showchars);

VideoReader/read in matlab

I use matlab 2018 in Windows 10.
I got an error message in reading avi-File in Matlab.
v = VideoReader('M-Movie_1.avi');
video = read(v);
I got this error-message
Error using VideoReader/read>readFramesUntilEnd (line 229)
Dot indexing is not supported for variables of this type.
Error in VideoReader/read (line 120)
videoFrames = readFramesUntilEnd(obj);
Error in main (line 7)
video = read(v);
any ideas what is going wrong?

Matlab: "Too many output arguments" when the correct number IS specified (AFAIK)

I have this code: http://pastebin.com/E70c4UYY
When running, I get the following error:
Error using Diffusivity.getParams
Too many output arguments.
Error in Diffusivity.D_BA (line 63)
[sigmaA, epsK_A] = Diffusivity.getParams(specieA);
Error in Diffusivity.D_Amix (line 95)
Dam = fractionsArray(j) / Diffusivity.D_BA(specieA, fractionsArrayNames_cellstr{j}, T, P);
I do not understand how it can give an error, since in the code, on line 63 and 64 I have specified that there are two outputs?
I fixed it by changing line 9 from [results] = getParams(specie) to [sigma, epsK] = getParams(specie) and then just deleting line 54.

Indexing matrices in matlab

So I have a script that I run j times. The following line produces an error:
[evec(:,:,j), eval(:,:,j)] = eig(T(:,:,j));
Error using mupadmex
Error in MuPAD command: Cannot compute the explicit
representation of the eigenvalues; use
'numeric::eigenvectors'. [linalg::eigenvectors]
Error in sym/mupadmexnout (line 2080)
out = mupadmex(fcn,args{:});
Error in sym/eig (line 68)
[V,D,p] = mupadmexnout('symobj::eigenvectors',A);
Error in SingleLayer (line 86)
[evec(:,:,j), eval(:,:,j)] = eig(T(:,:,j));
That is the error message I get. Am I correct creating 3 "sheets" (not sure how to describe it) like this. I

MATLAB error while convert str2num

i'm completely new to matlab and this is my first question.
I found a program like this
x = inputdlg('foo');
x = str2num(x{1})
and trying to make some gui from it, put this line to callback function of push button:
x=get(handles.edit1, 'String')
x=str2num(x{1})
and it works, but not after i add this the same thing with different variable
y=get(handles.edit2, 'String')
y=str2num(y{1})
command window said
Cell contents reference from a non-cell array object.
Error in regresilinear>pushbutton1_Callback (line 128)
x=str2num(x{1})
Error in gui_mainfcn (line 96)
feval(varargin{:});
Error in regresilinear (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in
#(hObject,eventdata)regresilinear('pushbutton1_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating uicontrol Callback
I found out that the output from command window is different when it's running and not with the same input.
When it got errors:
x =
0 1 2 3
when not (the first time)
x =
'0 1 2 3'
It doesn't give any error if i delete the str2num line.
I hope somebody can help fix the problem.
Start with a clear workspace and
x=get(handles.edit1, 'String');
x=str2num(x);
or better:
x=str2num(get(handles.edit1, 'String'));
{} are used for accessing the elements of a cell array. You are probably trying to use it on a string and that is why you are getting that error.