Effacer les filtres
Effacer les filtres

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 vues (au cours des 30 derniers jours)
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)

Réponses (1)

Geoff Hayes
Geoff Hayes le 5 Nov 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 commentaires
Rahul Pillai
Rahul Pillai le 5 Nov 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.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by