Type subscripts into output text dis()

15 ビュー (過去 30 日間)
Lew
Lew 2012 年 5 月 17 日
コメント済み: Walter Roberson 2017 年 12 月 4 日
So I am doing a bunch of calculations and when it gets done I would like to print the answer using the num2str command. However, I want to comment on it first and a lot of my variables have subscripts on them and I haven't been able to find a way to successfully at those in.
For example A_n is a variable I have. However, I would like to format it the way that looks neat not sloppy. That being said there has to be a way to do that inside a disp(' ') command.
So far I have tried: disp('a_n')
However, this doesn't work like it does for formatting plot axes.
Any help would be great! I have been looking for an answer for hours!!!

回答 (2 件)

Walter Roberson
Walter Roberson 2012 年 5 月 17 日
disp() cannot format text. fprintf() and sprintf() cannot format text either. All three of them are restricted to plain text, with a minor exception to produce red (for error messages) and blue (for links)

Serena Moon
Serena Moon 2017 年 12 月 4 日
Since none of those commands can format script, is there one that satisfies the question? I also wish to find something that will format text, while each text is num2str of a calculation, and cannot be done individually.
  1 件のコメント
Walter Roberson
Walter Roberson 2017 年 12 月 4 日
No, not in the command window -- not unless there happens to be a way to use the kinds of techniques used by the File Exchange contribution cfprint() [which I doubt, because I trust that Yair would already have implemented it if it could be done.]

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeEntering Commands についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by