Writing Strings to File in MATLAB

  • Context: MATLAB 
  • Thread starter Thread starter darthxepher
  • Start date Start date
  • Tags Tags
    File Matlab Writing
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
1 reply · 3K views
darthxepher
Messages
56
Reaction score
0
Hey,

so i want to write a string to a .txt file and I tried by doing this:

save filename.txt writer

(where writer is the variable containing string)
...
But i get weird char. instead of the string.
Any ideas?
 
Physics news on Phys.org
I solved it with a

fid = fopen(path,'wt');
fprintf(fid,writer);
fclose(fid);


:)