Saving multiple responses from a single edit text box
古いコメントを表示
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.
採用された回答
その他の回答 (1 件)
HUSNU CANBOLAT
2019 年 12 月 29 日
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);
カテゴリ
ヘルプ センター および File Exchange で Standard File Formats についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!