Save char to file

조회 수: 3 (최근 30일)
hu
hu 2014년 8월 8일
댓글: Image Analyst 2014년 8월 8일
Hi,
I have a char (name: CallSave, structure: <3x315 >) with this output
"
val =
I9.CLS;53;53;59;61;51;47;41;21;26;28;27;38;44;43;47;56;55;47;50;51;51;52;51;49;47;46;44;45;53...
I6.ALS;67;60;59;56;54;55;57;56;53;49;51;53;56;57;56;51;46;46;54;59;58;56;59;65;69;70;54;45;49...
I88.XAS;39;47;47;40;35;37;39;38;37;37;37;36;34;34;35;36;35;35;31;33;35;34;30;27;27;28;29;25;23...
"
How can I save it to a txt file?
Thanks

답변 (1개)

Image Analyst
Image Analyst 2014년 8월 8일
What are the members? Can you just do
fid = fopen(filename, 'wt');
fprintf(fid, '%s\n', CallSave.I9.CLS);
fprintf(fid, '%s\n', CallSave.I6.ALS);
fprintf(fid, '%s\n', CallSave.I88.XAS);
fclose(fid);
  댓글 수: 2
hu
hu 2014년 8월 8일
Unfortunately, it does not work. What I wish is to save it as it is, just that every file name is the start of a new row (e.g, I9.CLS, I6.ALS, I88.XAS). Thanks
Image Analyst
Image Analyst 2014년 8월 8일
But I don't know your structure's structure/field/members. Please give some code to create a CallSave structure or "val" structure or whatever you call it. Then we'll have something that we can work with. Right not we have nothing, except a bunch of guesses, which apparently are wrong.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 JSON Format에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by