Save char to file

1 view (last 30 days)
hu
hu on 8 Aug 2014
Commented: Image Analyst on 8 Aug 2014
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

Answers (1)

Image Analyst
Image Analyst on 8 Aug 2014
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 Comments
hu
hu on 8 Aug 2014
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 on 8 Aug 2014
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.

Sign in to comment.

Categories

Find more on Data Type Conversion in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!