Info
This question is closed. Reopen it to edit or answer.
How I can read variables from a .txt?
1 view (last 30 days)
Show older comments
I have a GUI and I need to save some variables in a .txt to export to another platform while you can rerun the GUI with the same values at any time
My code is:
function Save_Callback(hObject, eventdata, handles)
global D F W
File=get(handles.edit1,'String');
save(File, 'D', '-ASCII','-append');
save(File, 'F', '-ASCII','-append');
save(File, 'W', '-ASCII','-append');
function Load_Callback(hObject, eventdata, handles)
global D F W
File=get(handles.edit2,'String');
4 Comments
dpb
on 23 Jul 2014
Edited: dpb
on 23 Jul 2014
I can not find the example...
It's the "Load ASCII File" example.
NB in the doc for save that if you try to use load for ASCII files written by save that all variables must have same number of columns which your variables above do not--hence you canNOT use save/load in this fashion for your purposes.
For export purposes do you need to keep the shape? Does the other system know the shape/size a priori? If not it'd probably simplify that side's job to write it as a header record as well as the data and/or use a csv file or similar.
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!