Question

Suppose that I have a button in a window that when I click on it a new window will appear. I call this window (with the name of My_New_Window) with this syntax:

My_New_Window();

I want to insert some values to this new window from main window. I know that I can use setappdata or getappdata for this purpose but Is there another way to this? For example like this syntax:

My_New_Window(Values);

Another question. When we use setappdata or getappdata, where MATLAB stores this data? In the RAM or Hard drive?

Was it helpful?

Solution

  1. Yes, you can use My_New_Window(Values); For example, in GUIDE, whatever parameters you pass to your GUI, you can handle in the OpeningFcn using its varargin input. Simply assign varargin to your handles structure and use guidata(hObject, handles);

  2. Regarding setappdata - according to this book the data is stored inside an "object". Since objects reside in memory, it is safe to assume that it is indeed kept in RAM.

OTHER TIPS

You can store data in the GUI UserData property:

set(handletoFigure,'UserData',Values);

when you open the other GUI you retrieve the info:

Values = get(handletoFigure,'UserData);

Is there a reason why you don't want to use setappdata/getappdata?

As for your 2nd question I don't know sorry. I guess it's the RAM though

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top