Get value of a variable

조회 수: 2 (최근 30일)
Cristian Martin
Cristian Martin . 2022년 5월 17일
댓글: Cristian Martin . 2022년 5월 18일
-file display.m-
selectedCar = handles.popupmenu1.Value;
switch selectedCar
case 2
owners = TYPE1;
-file modify.m-
here i have a pop up and an edit text
How cand I call variable TYPE1 from file display.m, display it on edit text and after that re writing it back to same variable on display.m
Thank you!
  댓글 수: 3
Cristian Martin
Cristian Martin 2022년 5월 17일
@Geoff Hayes those two.m files are script files made by automatically by GUI. I want to call the text generated in an edit text box by a function in a pop-up menu from first file in another edit text box file and modify and save in a first file. I hope I mede my self clear. If not please let me know. Thanks
Geoff Hayes
Geoff Hayes 2022년 5월 17일
@Cristian Martin - can you show some of the code or post the two files? I'm just curious as to what data is being written to these files. It may be simpler to just keep the data (that is written to the file) as a variable/property of the handles struct so that you don't have to open the file to read the contents just to write to the edit text control. Unless you are allowing the user to write data to the file via the GUI

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

채택된 답변

Mitch Lautigar
Mitch Lautigar 2022년 5월 17일
When you call an edit text box, the user inputs some text which will then save. If it is a popup window you are using, you should be able to get the outputs from the user. If this is a popup window in the GUI itself, the value you are looking for will look like "handles.popup1.String"
  댓글 수: 6
Cristian Martin
Cristian Martin 2022년 5월 18일
Thank you Mitch Lautigar
Cristian Martin
Cristian Martin 2022년 5월 18일
Error using subsindex
Function 'subsindex' is not defined for values of class 'cell'.
Error in test>pushbutton6_Callback (line 784)
TIP1 = [handles.edit1.String(TIP1);intraretext];
Error in gui_mainfcn (line 95)
Error in test (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in @(hObject,eventdata)test('pushbutton6_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating UIControl Callback

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

추가 답변 (0개)


Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기




Community Treasure Hunt

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

Start Hunting!

Translated by