필터 지우기
필터 지우기

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 (최근 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에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by