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?

2 次查看(过去 30 天)
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)

回答(1 个)

Geoff Hayes
Geoff Hayes 2017-11-5
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 个评论
Rahul Pillai
Rahul Pillai 2017-11-5
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.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Data Import and Analysis 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by