when I use the slider in MATLAB gui to display images stored in a matrix an error is shown.

조회 수: 1 (최근 30일)
Since am performing image processing techniques after storing the data in the matrix, its required that I use setappdata and getappdata to move the data around.However after I pass it to the final function , after about 9 frames the 10th frame gives an error.
the error being-
Error using images.internal.imageDisplayValidateParams>validateCData (line 115)
Multi-plane image inputs must be RGB images of size MxNx3.
Error in images.internal.imageDisplayValidateParams (line 27)
common_args.CData = validateCData(common_args.CData,image_type);
Error in images.internal.imageDisplayParseInputs (line 78)
common_args = images.internal.imageDisplayValidateParams(common_args);
Error in imshow (line 223)
[common_args,specific_args] = ...
Error in MAINTRIAL2>slider2_Callback (line 240)
imshow(P(:,:,C1),'parent',handles.axes6);
Error in gui_mainfcn (line 95)
feval(varargin{:});
Error in MAINTRIAL2 (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in @(hObject,eventdata)MAINTRIAL2('slider2_Callback',hObject,eventdata,guidata(hObject)),
Please do help

채택된 답변

Walter Roberson
Walter Roberson 2016년 5월 17일
C1 = str2double( get(handles.edit2,'String') );
Or better yet, just index by C as it is already the numeric value.

추가 답변 (1개)

Image Analyst
Image Analyst 2016년 5월 17일
What does this code show in the command window if you put it just before line 240:
whos P
whos C1
C1
What happens if you visit this link?
  댓글 수: 2
Deandra  Dsouza
Deandra Dsouza 2016년 5월 17일
편집: Walter Roberson 2016년 5월 17일
C=get(hObject,'Value');
% tr2=(tr1);
assignin('base','sliderVal',C);
set(handles.edit2,'String',num2str(round(C)));
C1=get(handles.edit2,('String'));
disp('C1')
disp(C1)
disp('C')
disp(C)
P=getappdata(0,'Segmented');
O=getappdata(0,'thresholding');
% figure();
% subplot(1,2,1);
imshow(P(:,:,C1),'parent',handles.axes6);
% subplot(1,2,2);
imshow(O(:,:,C1),'parent',handles.axes7);
guidata(hObject,handles);
Image Analyst
Image Analyst 2016년 5월 17일
That's not the code I gave you. There is no whos and I didn't say to use disp(). Anyway, try this:
C1 = str2double(handles.edit2.String);
I recommend you don't use assignin() and pick more descriptive names than C, C1, P, and (worst of all!) O.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Geometric Transformation and Image Registration에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by