MATLAB: Do I get this error

rectangular empty matrix

I get this error in the third line
"Improper assignment with rectangular empty matrix."
When I run this code
handles = guidata(hObject);
for j = 1:1:length(handles.cycleList)
maxStrain(j) = max(handles.graphEpsilon(handles.newHighPoints(j)+1:handles.newHighPoints(j+1)));
minStrain(j) = min(handles.graphEpsilon(handles.newHighPoints(j)+1:handles.newHighPoints(j+1)));
The length of cycleList is 740. The length of handles.newHighPoints is 778. I read several other forums but could not figure it out. Why am I getting this error?

Best Answer

  • My guess is that:
    is greater than:
    so the colon operator evaluates this as an empty vector (it will not decrement unless you tell it to), and the matrix evaluates as empty.
    v = 2:1
    evaluates to:
    v =
    Empty matrix: 1-by-0