Thread Subject: How to modify a string cell value totally?

Subject: How to modify a string cell value totally?

From: damayi

Date: 25 Dec, 2007 01:22:49

Message: 1 of 3

Dear all
Supposed that there is a cell array, contained
'Dollar', 'Pond', 'RMB', I mean
CArray = {'Dollar'; 'Pond'; 'RMB'};
I hope that CArray can be modified as below in a simple way.
{'100 Dollar OK'; '100 Pond OK'; '100 RMB OK'};
I tried to use 'cat' function, but failed.
Any idea?

Best regards
damayi
2007-12-25

Subject: How to modify a string cell value totally?

From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)

Date: 25 Dec, 2007 03:14:14

Message: 2 of 3

In article <ef122049-d1f8-4b1d-97af-ab2d7d10a692@y5g2000hsf.googlegroups.com>,
damayi <damayi@gmail.com> wrote:
>Dear all
>Supposed that there is a cell array, contained
>'Dollar', 'Pond', 'RMB', I mean
>CArray = {'Dollar'; 'Pond'; 'RMB'};
>I hope that CArray can be modified as below in a simple way.
>{'100 Dollar OK'; '100 Pond OK'; '100 RMB OK'};
>I tried to use 'cat' function, but failed.

cellfun(@(string) ['100 ' string ' OK'], CArray, 'UniformOutput', 0)
--
  "There are some ideas so wrong that only a very intelligent person
  could believe in them." -- George Orwell

Subject: How to modify a string cell value totally?

From: Huy

Date: 25 Dec, 2007 03:20:48

Message: 3 of 3

damayi <damayi@gmail.com> wrote in message <ef122049-d1f8-
4b1d-97af-ab2d7d10a692@y5g2000hsf.googlegroups.com>...
> Dear all
> Supposed that there is a cell array, contained
> 'Dollar', 'Pond', 'RMB', I mean
> CArray = {'Dollar'; 'Pond'; 'RMB'};
> I hope that CArray can be modified as below in a simple way.
> {'100 Dollar OK'; '100 Pond OK'; '100 RMB OK'};
> I tried to use 'cat' function, but failed.
> Any idea?
>
> Best regards
> damayi
> 2007-12-25

The function strcat could be useful for you, for example:

strcat(CArray,' OK')


Anh Huy Phan

RIKEN-BSI





Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

rssFeed for this Thread

Public Submission Policy

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.

Contact us at files@mathworks.com