Info

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

Getting error while plotting a 2d countour

조회 수: 1 (최근 30일)
Rajanikanta Swain
Rajanikanta Swain 2016년 10월 24일
마감: MATLAB Answer Bot 2021년 8월 20일
Getting error while plotting a 2d countour plot in my GUI pushbutton functin. Is there any differnce in gui contour and ordinary countur plot? Also how to enter a matrix as input in my gui front pannel... Please helpme...
  댓글 수: 1
Alexandra Harkai
Alexandra Harkai 2016년 10월 25일
What is the error you're getting? What is it you're trying to plot? Without these it's quite hard to see where your issue is.

답변 (1개)

Marc Jakobi
Marc Jakobi 2016년 10월 25일
In a GUI created in GUIDE, you may have to specify the axes in which to create the contour.
contour(handles.axesName, x, y, z, ...)
You can find/set the "axesName" in the Tag property of the axes.
  댓글 수: 2
Rajanikanta Swain
Rajanikanta Swain 2016년 10월 25일
Thanks. This worked.... Please help me to with calling an array from GUI pannel in to the Pushbutton function. The comands like X=str2num(get(handles.edit8,'string')); X=str2double(get(handles.edit8,'string'));
they dont work. Like i enter X=[5,-5] in Gui Pannel and it calls in main prgram when i run the gui... Is there any command to handle these?
Thanks
Marc Jakobi
Marc Jakobi 2016년 10월 25일
Glad I could help. Please accept my answer if it helped you.
str2num('X=[5,-5]')
will return an empty value and
str2double('X=[5,-5]')
will return NaN (Not a Number). This is because the string 'X=[5,-5]' is not a number. You will have to find a way to extract the numbers from the string 'X=[5,-5]', e. g.
Str = get(handles.edit8, 'String'); % returns the string 'X=[5,-5]'
i1 = strfind(Str, '[');
a = sscanf(Str(i1 + 1:end), '%g', 1);
i2 = strfind(Str, ',');
b = sscanf(Str(i2 + 1:end), '%g', 1);
X = [a, b];

제품

Community Treasure Hunt

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

Start Hunting!

Translated by