MATLAB Answers

Why did I get different print format in the output txt file?

2 views (last 30 days)
Dear All,
I used Matlab compiler to generate a standalone application exe file. I then tested it in 3 different computers. I obtained good printing format in the result txt file using my iMac and new Dell (2019), but obtained bad printing format in the result txt file using my old Dell (2015). I copied parts of the results from different computers and compare them as follows:
I. iMac and new Dell
II. Old Dell
I am wondering why the alignment of columns when using my old Dell are Not as good as those when used my iMac and new dell. How can I fix this problem?
Thanks.
Benson

Accepted Answer

Stephen Cobeldick
Stephen Cobeldick on 13 Jul 2020
Edited: Stephen Cobeldick on 13 Jul 2020
"I am wondering why the alignment of columns when using my old Dell are Not as good as those when used my iMac and new dell."
This has absolutely nothing to do with MATLAB.
It is because you are not using a fixed-width (aka monospaced) typeface in that text editor.
"How can I fix this problem?"
Change the text editor to use a fixed-width font, e.g. Consolas or Courier or PT Mono (which is what your first screenshot appears to show, whereas the second screenshot appears to show Arial, which is a variable-width typeface).
In MS Notepad change the font via menus Format -> Font... and then select the font.

  9 Comments

Show 6 older comments
Stephen Cobeldick
Stephen Cobeldick on 14 Jul 2020
"So it is Impossible to set up the printing format in my Matlab code, right?"
The fact that text files do not store formatting information has nothing to do with MATLAB. Text files do not store formatting information. End of story.
"How about using other printing type like excel instead of text file?"
Excel workbooks do store formatting information for the cell contents. Due to their readability, simplicity, and universality text files are usually preferred over more complex fle formats for data exchange.
Walter Roberson
Walter Roberson on 2 Aug 2020
An increasing number of "binary" file formats turn out to be compressed text file formats -- combining the smaller size of binary with the flexibility of processing the text.
However, there are some contexts such as CDF and HDF5 file formats that are structured binary files that are not text. Some of those standardized binary file formats have advantages in being more consistent in making the metadata more explicit -- for example being much more clear as to how the files represent time.
MATLAB -v7.3 files are HDF5 files underneath, but the structure of HDF5 files is not an especially good match for structured compound data types like MATLAB uses, so -v7.3 .mat files can be much larger and slower than the proprietary -v7 format.

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!