data transfer from GUI to M file

Hello everyone,

i wrote a program for my senior project using M file , but the user have to input 18 values in the boxes that i have entered in the Gui as follows:

How can i link the first value for example, in the M file i called this value P_h how can i let the entered value from the user for the first box that it is the value of P_h when i run the program this is an example of what i mean

댓글 수: 1

Star Strider
Star Strider 2014년 11월 1일
We need to see your code for the GUI, and how you input your data.

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

답변 (1개)

Image Analyst
Image Analyst 2014년 11월 1일

0 개 추천

You have to know the "tag" of the edit field. Let's say you called it editPH. So then whenever you need this string in that edit box, you do this:
P_h = get(handles.editPH, 'String');
If you need it to be a number then
P_h = str2double(P_h);
Of course you should do some validation on the string to make sure they only types in valid numerical symbols 0-9 plus minus sign and period, before you call str2double().

댓글 수: 3

abdulla ishaq
abdulla ishaq 2014년 11월 1일
thank you a lot it worked , what about the run button, how can i make it as a trigger for my m file ?
Image Analyst
Image Analyst 2014년 11월 1일
I don't know what you mean. Just put whatever code you want into the callback for the pushbutton. Attach your .fig, .m, and data files if you want more help.
KALYAN KUMAR
KALYAN KUMAR 2015년 7월 1일
편집: KALYAN KUMAR 2015년 7월 1일
can i know how to input the variables in m-files using GUI i have three variables 2 were numeric and 1 is alpha numeric . i want to use popup menu. can i know how to pass input data to m-file variables from GUI popup menu

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

카테고리

도움말 센터File Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

질문:

2014년 11월 1일

편집:

2015년 7월 1일

Community Treasure Hunt

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

Start Hunting!

Translated by