Borrar filtros
Borrar filtros

How do I save data from a matlab GUI table onto a text file when the user clicks a pushback button on the same gui?

4 visualizaciones (últimos 30 días)
writetable(T) only saves data to a textfile in the same location as the program. I want to be able to give the user an option to enter his own text file name and location. Please suggest what code I should enter in my callback as shown:
% --- Executes on button press in savebutton.
function savebutton_Callback(hObject, eventdata, handles)
% hObject handle to savebutton (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

Respuestas (1)

Geoff Hayes
Geoff Hayes el 5 de Nov. de 2017
Rahul - according to writetable, you can specify the full path along with the filename. So if you have a table T, then you would save it to some file as
fullpathAndFilename = '/users/geoff/mytable.txt';
writetable(T, fullpathAndFilename);
Try the above and see what happens!
  4 comentarios
Rahul Pillai
Rahul Pillai el 5 de Nov. de 2017
The writetable function makes use of a write() function inside of it's code structure. When I made a call to writetable() the error generated pointed to this.

Iniciar sesión para comentar.

Categorías

Más información sobre Migrate GUIDE Apps en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by