MATLAB: How to save GUI’s listbox content to a text file or excel file

excellistboxMATLABtext file

I have a GUI and in it's listbox, some data is generated and I want to save these data to a excel file or text file. What to do inside callback for save.

Best Answer

ayan - in the save (button?) callback, just extract the data from the listbox as
lbData = get(handles.listbox1,'String');
where listbox1 is the name/tag for your listbox control. You can then save the lbData variable to a mat file or text file. If the data is a cell array, see export cell array to text file for details.