0

I have a string, it shows as follow:

Str = '+1 3:0.045 7:1.726 8:0.63'

My question is how to save the string into a text file by using Matlab. Thanks a lot!!

1 Answer 1

2
fileID = fopen ('fileName.txt', 'w') ;
Str = ‘+1 3:0.045 7:1.726 8:0.63’ ;
fprintf(fileID, str) ;
Sign up to request clarification or add additional context in comments.

4 Comments

you did not specify the location of the saved file.How to specify the location?
@PeterLi It goes into the current working directory.
@David: Thanks for explanation. Due to weekend, I could not access my computer and saw this conversation very late.
@PeterLi: You can specify the complete path to text file in which you want to save data instead of 'fileName.txt'. It is my mistake that I could not provide the details.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.