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:
Matlab String Format

Subject: Matlab String Format

From: Prakhar

Date: 22 Dec, 2010 00:09:07

Message: 1 of 3

Hi,

I'm writing a Matlab script which uses Cantera. I want to do the following in Matlab:

>> a = 5;
>> b = 'H2:a'

b =

H2:a

So instead of 'a' in the answer, i want the value of 'a'. i.e i need answer as:

b = H2: 5

The value of 'a' keeps changing in the code, and hence 'b' needs to be updated. Any help will be appreciated.

Thanks
Prakhar Mehrotra
(Grad Student)

Subject: Matlab String Format

From: markwhirdy

Date: 22 Dec, 2010 00:32:15

Message: 2 of 3

b = ['H2:' num2str(a)];

Subject: Matlab String Format

From: Prakhar

Date: 22 Dec, 2010 00:52:08

Message: 3 of 3

markwhirdy <user@compgroups.net/> wrote in message <RvqdnRdTypKS2ozQnZ2dnUVZ_gednZ2d@giganews.com>...
> b = ['H2:' num2str(a)];
>



It worked...Thanks a lot!!

Tags for this Thread

No tags are associated with 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