MATLAB Answers

How does "disp" formatting work exactly?

31 views (last 30 days)
Greetings,
I am converting some PDFs using Matlab and the way I want the final text to look is exactly how "disp" displays it. However, I am scratching my head of how to capture that in a way that I can write it to a word document or capure that exact process that "disp" does using fprintf. Any ideas?

  0 Comments

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 16 May 2019
None of the disp() formats correspond to single fprintf() formats. They all examine the range and data type of what they are displaying and choose output format dynamically. The output it uses for a vector of values might be different than what it uses for the values individually.
You can evalc() to capture the results of disp(), or you might be able to use diary() for your purposes.

  2 Comments

dsmalenb
dsmalenb on 17 May 2019
I used diary and it works ... somewhat. evalc seems to require a string to process and since I need to update the location dynamically it doesn't seem to like to accept that with the strcat function.
Basically, how do you write to a text doc how Matlab would display it in the command window automatically?

Sign in to comment.

More Answers (0)

Sign in to answer this question.

Products


Release

R2016b