필터 지우기
필터 지우기

How to enter an array in Matlab GUI front pannel....

조회 수: 2 (최근 30일)
Rajanikanta Swain
Rajanikanta Swain 2016년 10월 25일
댓글: Adam 2016년 10월 26일
.... 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

답변 (1개)

Adam
Adam 2016년 10월 25일
Just enter the raw data in the edit box as e.g
5 -5
then use
X = cell2mat( textscan( get(handles.edit8,'string'), '%f' ) );
or use '%d' if you want integers type.
  댓글 수: 2
Rajanikanta Swain
Rajanikanta Swain 2016년 10월 26일
편집: Rajanikanta Swain 2016년 10월 26일
Thanks adam.... please see the error after using your code.....
Adam
Adam 2016년 10월 26일
What is the exact code you have and what does
get(handles.edit8,'string')
give you if you put a breakpoint in your callback and put that on command line?
textscan has an overload that works with a character array supplied as the first argument rather than only with a file id

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

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by