Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Adding a paranthese and Bold letters to a cell array

Subject: Adding a paranthese and Bold letters to a cell array

From: Thomas

Date: 16 Nov, 2004 15:55:20

Message: 1 of 10

Hello,

I have a cell array matrix t,

x=
0.9501 0.2311 0.6068 0.4860

t(1:4)=num2cell(x)

I want to add a paranthese to all the x numbers in the t matrix and
if x>0.5 I want this value to be in Bold letters in the t matrix.
Is it possible to do this with matlab?
Thx

Subject: Adding a paranthese and Bold letters to a cell array

From: Michael Robbins

Date: 16 Nov, 2004 16:09:31

Message: 2 of 10

Thomas wrote:
>
>
> Hello,
>
> I have a cell array matrix t,
>
> x=
> 0.9501 0.2311 0.6068 0.4860
>
> t(1:4)=num2cell(x)
>
> I want to add a paranthese to all the x numbers in the t matrix and
> if x>0.5 I want this value to be in Bold letters in the t
> matrix.
> Is it possible to do this with matlab?
> Thx

Not in the command window. You can display it like that in a figure,
or in another program like Excel or Word. The command window,
however, is somewhat limited.

Subject: Adding a paranthese and Bold letters to a cell

From: per s

Date: 16 Nov, 2004 16:23:12

Message: 3 of 10

Thomas wrote:
>
>
> Hello,
>
> I have a cell array matrix t,
>
> x=
> 0.9501 0.2311 0.6068 0.4860
>
> t(1:4)=num2cell(x)
>
> I want to add a paranthese to all the x numbers in the t matrix and
> if x>0.5 I want this value to be in Bold letters in the t
> matrix.
> Is it possible to do this with matlab?
> Thx

Try: ['(',num2str(x(1),4),')'] if x(1)>0.5. Bold I don't know.
It's moore a question of which font the matlab prompt is using I
think. Maby there is options for that?

Per

Subject: Adding a paranthese and Bold letters to a cell array

From: Kristin Thomas

Date: 17 Nov, 2004 08:21:22

Message: 4 of 10

Bold text cannot be displayed in the Command Window. I have an
enhancement request for this for a future release.

In addition to displaying bold text in a figure as Michael suggested
(which I haven't tried), you can display html to the MATLAB web browser
and embed bold tags in the html text.

See:

help web

Hope this helps,
Kristin

---------------------------------------------------------
Kristin Thomas
Software Engineer
The MathWorks, Inc.
kthomas@mathworks.com
---------------------------------------------------------


Thomas wrote:
> Hello,
>
> I have a cell array matrix t,
>
> x=
> 0.9501 0.2311 0.6068 0.4860
>
> t(1:4)=num2cell(x)
>
> I want to add a paranthese to all the x numbers in the t matrix and
> if x>0.5 I want this value to be in Bold letters in the t matrix.
> Is it possible to do this with matlab?
> Thx

Subject: Adding a paranthese and Bold letters to a cell array

From: Michael Robbins

Date: 17 Nov, 2004 08:27:28

Message: 5 of 10

> Bold text cannot be displayed in the Command Window. I have an
> enhancement request for this for a future release.
>
> In addition to displaying bold text in a figure as Michael
> suggested
> (which I haven't tried), you can display html to the MATLAB web
> browser
> and embed bold tags in the html text.

I can't see a great deal of benefit to adding fancy printing to the
console, except for being able to see WYSIWIG equations.

At least, it should be possible to display them in a figure without
installing LaTeX.

At best, you should add a MathType style equation editor.

Both enhancements would make math much easier and user friendly.

Subject: Adding a paranthese and Bold letters to a cell array

From: Kristin Thomas

Date: 17 Nov, 2004 08:43:46

Message: 6 of 10

Michael Robbins wrote:
> I can't see a great deal of benefit to adding fancy printing to the
> console, except for being able to see WYSIWIG equations.
>
> At least, it should be possible to display them in a figure without
> installing LaTeX.
>
> At best, you should add a MathType style equation editor.
>
> Both enhancements would make math much easier and user friendly.

Thanks for the suggestions Michael!

Kristin

Subject: Adding a paranthese and Bold letters to a cell array

From: quo

Date: 17 Nov, 2004 10:49:27

Message: 7 of 10

> Michael Robbins wrote:
>> I can't see a great deal of benefit to adding fancy printing to
> the
>> console, except for being able to see WYSIWIG equations.

I disagree! I use matlab to run experiments with human subjects, and
I frequently monitor thier progress with fprintf statements. Being
able to use bold or colors in the command window would be incredibly
helpful. Sometimes a message is critical to note, but you don't want
to stop the process like with error.

-quo

Subject: Adding a paranthese and Bold letters to a cell array

From: Kristin Thomas

Date: 17 Nov, 2004 13:44:10

Message: 8 of 10

Thanks Quo. It is nice to know how the bold and color would be useful.

Kristin

quo wrote:
>>Michael Robbins wrote:
>>
>>>I can't see a great deal of benefit to adding fancy printing to
>>
>>the
>>
>>>console, except for being able to see WYSIWIG equations.
>
>
> I disagree! I use matlab to run experiments with human subjects, and
> I frequently monitor thier progress with fprintf statements. Being
> able to use bold or colors in the command window would be incredibly
> helpful. Sometimes a message is critical to note, but you don't want
> to stop the process like with error.
>
> -quo

Subject: Adding a paranthese and Bold letters to a cell array

From: Michael Skalicky

Date: 4 Mar, 2011 01:50:06

Message: 9 of 10

quo <none@email.com> wrote in message <eef3248.5@webx.raydaftYaTP>...
> > Michael Robbins wrote:
> >> I can't see a great deal of benefit to adding fancy printing to
> > the
> >> console, except for being able to see WYSIWIG equations.
>
> I disagree! I use matlab to run experiments with human subjects, and
> I frequently monitor thier progress with fprintf statements. Being
> able to use bold or colors in the command window would be incredibly
> helpful. Sometimes a message is critical to note, but you don't want
> to stop the process like with error.
>
> -quo

There is a way to output red text without using error :

fprintf(2,'<red text here>')

Doing so outputs red text in the command window. Note also that this turns the entire line red, so it's impossible to just turn a single word or number red. However, splicing it with different fprintf(2,' ') statements on different lines (\n operator) will give you a single red word or number, or phrase, such as:

fprintf('Variable Values:\n\n')
fprintf('MeanResistors \nValue = \n')
fprintf(2,'%g \n',MeanResistors)
fprintf('Units = Ohms\n\n')

Subject: Adding a paranthese and Bold letters to a cell array

From: Yair Altman

Date: 4 Mar, 2011 08:08:05

Message: 10 of 10

> There is a way to output red text without using error :
>
> fprintf(2,'<red text here>')
>
> Doing so outputs red text in the command window. Note also that this turns the entire line red, so it's impossible to just turn a single word or number red. However, splicing it with different fprintf(2,' ') statements on different lines (\n operator) will give you a single red word or number, or phrase, such as:
>
> fprintf('Variable Values:\n\n')
> fprintf('MeanResistors \nValue = \n')
> fprintf(2,'%g \n',MeanResistors)
> fprintf('Units = Ohms\n\n')


You can output *ANY* color to the command window, on any part of the line, using the CPRINTF utility, as explained here:
http://UndocumentedMatlab.com/blog/cprintf

Yair Altman
http://UndocumentedMatlab.com

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us