MATLAB Answers

0

Writeing a stings using Matlab 2015

Asked by Hassan Qassim on 16 Feb 2019
Latest activity Commented on by Star Strider
on 17 Feb 2019
Hello All
i am working on algorithm that has the ability to creat a text file and write on it depending on specific commands.
i am in need to write words using matlab and the results should be showed simultaneously in the text file (no need to re-open the text file again).
i am looking for something like attached photo.
Any suggestions?
regards
Untitled.jpg

  0 Comments

Sign in to comment.

Tags

Products


Release

R2015a

1 Answer

Answer by Star Strider
on 16 Feb 2019
 Accepted Answer

The standard output (The Command Window) has a file identification number = 1.
So:
fprintf(fid, 'Hello\nWorld\n')
will print to the file , and
fprintf(1, 'Hello\nWorld\n')
or in more recent releases:
fprintf('Hello\nWorld\n')
will print to the Command Window.

  4 Comments

Show 1 older comment
My pleasure.
The approach in my code will allow you to write it to your file and write it to your Command Window. They will not be written absolutely simultaneously, but closely enough.
I will use the command window for showing up the written words, thanks a lot for your help
really apreciated
As always, my pleasure.

Sign in to comment.