Creating Dynamic Vector in Matlab GUI

1 visualizzazione (ultimi 30 giorni)
Phil
Phil il 3 Dic 2013
Commentato: Simon il 4 Dic 2013
I have an image upload box in my Matlab GUI. In this GUI, I would like to create a vector that adds the actual file name of each of these images that I have uploaded. For example: If I upload 5 images I want a vector with 5 file-name listed. I need to track what files names have been called in the past for other parts of my code. I have tried using a counter loop type operation with no success. Any suggestions are much appreciated!

Risposte (1)

Simon
Simon il 3 Dic 2013
Hi!
Use a cell array for your file names (strings). Each time you upload a new image you add one cell to the array. After that store the array with "guidata", so that you can get it back every time a new image is uploaded.
  2 Commenti
Phil
Phil il 3 Dic 2013
can you explain how to initialize the cell array on order to save the first file name inputted?
Simon
Simon il 4 Dic 2013
Hi!
The GUI has an opening function that is executed before the GUI is shown. I place my initial values there:
handles.FileNames = {};
% Update handles structure
guidata(hObject, handles);
Afterwards in the upload callback function you can add the file name like
handles.FileNames = [handles.FileNames; CurrentName];
Don't forget to store "handles" at the end of the callback function!

Accedi per commentare.

Categorie

Scopri di più su Interactive Control and Callbacks in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by