Subscripted Assignment Dimension Mismatch when using ROIPOLY in a GUI

1 view (last 30 days)
Hi. I'm fairly new to all of this stuff, so I'm having a hard time comprehending what could be going wrong. I've searched around, and nothing has really made it clear.
I have a GUI script that seeks to segment portions on an image (derived from a .mat file with numerous variables) using roipoly. For the most part it works... But there are a few bugs, one involving this error occurring, and the quickest way to fix it is to close and reopen the GUI, which is not ideal. I'm having a hard time tracing through the program to find what could cause it to only sometimes happen.
Here's where the error occurs (idx is usually just 1):
while go == 0
[handles.x_crop_pandn,...
handles.y_crop_pandn,...
handles.BW_crop(:,:,idx),...
handles.xi_crop_pandn(:,idx),...
handles.yi_crop_pandn(:,idx)] = roipoly();
And the error:
Subscripted assignment dimension mismatch.
Error in HistologySegmentationGUI>pushbutton8_Callback (line 287)
[handles.x_crop_pandn,...
Error in gui_mainfcn (line 96)
feval(varargin{:});
Error in HistologySegmentationGUI (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in @(hObject,eventdata)HistologySegmentationGUI('pushbutton8_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating uicontrol Callback
And, if I do size( these variables: (just in case it provides any useful info that I don't understand)
K>> size(handles.x_crop_pandn)
ans =
1 4721
K>> size(handles.y_crop_pandn)
ans =
1 210
K>> size(handles.yi_crop_pandn)
ans =
23 1
K>> size(handles.xi_crop_pandn)
ans =
23 1
K>> size(handles.BW_pandn)
ans =
1370 4721
Let me know if you have any guidance, thoughts, or need for more information. Thank you!

Accepted Answer

Image Analyst
Image Analyst on 19 May 2015
Assign them to single variables first, like the help shows you. Then, after that, stuff them into 3D arrays or whatever.

More Answers (0)

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!