Saving multiple responses from a single edit text box
Mostra commenti meno recenti
I am trying to save multiple responses from a single edit text box each time the user pushes a "save" button. Below is my code:
function pushbutton1_Callback(hObject, eventdata, handles)
s = get(handles.edit1, 'String');
output_s = fopen('GUIDATA.txt','a');
formatspec = '%s';
fprintf(output_s,'%s',s);
fclose(output_s);
end
I'm getting a .txt file with a long string of the responses, but I'd like to eventually have a list of words that the user will hear in the first column, and the user input be saved in the second column, something like this
Target word User response
hello <user input from edit text box>
wall <user input from edit text box>
Thanks for any help in advance. I'm fairly new to Matlab and just can't seem to figure this out.
Risposta accettata
Più risposte (1)
HUSNU CANBOLAT
il 29 Dic 2019
ca={handles.text_bilgiler} ;
str = char(ca);
fid = fopen(strcat('test.txt'), 'w');
formatSpec = '%s\n';
[nrows,ncols] = size(str);
for row = 1:nrows
fprintf(fid,formatSpec,str(row,:));
end
fclose(fid);
Categorie
Scopri di più su Standard File Formats in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!