Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

how to transfrer data in guide ?

Asked by Itzik Ben Shabat on 13 Jan 2013

Hi, I have built a UI in guide. I have created an "edit text" function. I wish to allow the user to insert a numeric value and have that value saved and reused in other functions in my program. the problem is that if the user does not insert a value an error occurs. how can i assign a default value (and have it usable in all functions in the program)? thanks

0 Comments

Itzik Ben Shabat

Tags

Products

No products are associated with this question.

1 Answer

Answer by Azzi Abdelmalek on 13 Jan 2013
Edited by Azzi Abdelmalek on 13 Jan 2013
Accepted answer

In you opening function insert a code below:

set(handles.edit1,'string','YourDefaultValue')

Which functions? to read your value just use

YourValue= str2double(get(handles.edit1,'string'))

You can also use guidata to transfer your data

1 Comment

Itzik Ben Shabat on 13 Jan 2013

i tried guidata but for some reason it didnt save it... (i used it several times in my program and it worked fine but for this speceific application it didnt).

what you said worked, thanks

Azzi Abdelmalek

Contact us