필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Need help in the code GUI!

조회 수: 1 (최근 30일)
sha
sha 2012년 11월 22일
마감: MATLAB Answer Bot 2021년 8월 20일
Hi there,
i have some problems with the Gui code. I need to calculate the difference on all the 6 images and display it with the command colormap using my formula.
Heres the code:
-------------------------------
global I1c I2c I3c I4c I5c I6c; // the image
global theta1 theta2 ftheta;
global delta1 delta2 delta3 fdelta;
global averagef N stress;
dia = str2num(get (handles.thickness, 'String'));
fringe = str2num(get (handles.fringe2, 'String'));
theta1=I5c-I3c;
theta2=I4c-I6c;
ftheta=(1/2)*atan(theta1.*theta2);
delta1=I5c-I4c;
delta2=I1c-I2c;
delta3=sin(2.*ftheta)-cos(2.*ftheta);
fdelta=atan(2.*(delta1./(delta2.*delta3)));
N=fdelta./(2*pi);
stress=(N*averagef)/dia;
set(handles.stressDifference, 'String', stress);
axes(handles.axes11)
imagesc(abs(stress)),title('Stress distribution in the tooth'),xlabel('Pixel'),ylabel('Pixel'),colorbar,colormap(jet);
---------------------------------------------
Heres the error:
??? Error using ==> mtimes Inner matrix dimensions must agree.
Error in ==> New>StressButton_Callback at 846 stress=(N*averagef)/dia;
Error in ==> gui_mainfcn at 96 feval(varargin{:});
Error in ==> New at 42 gui_mainfcn(gui_State, varargin{:});
Error in ==> @(hObject,eventdata)New('StressButton_Callback',hObject,eventdata,guidata(hObject))
??? Error while evaluating uicontrol Callback
I need help in this! THANKS!

답변 (1개)

Image Analyst
Image Analyst 2012년 11월 22일
You're doing a matrix multiplication (not an element-by-element multiplication) of N and averagef. They are different sizes. Set a breakpoint there and find out what sizes they are. Learn how to use the debugger and these kinds of problems can be solved in seconds without the long delay involved in asking us.

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by