|
|
How can I add string to an integer matrix ??
Can you tell me how can I add string to a matrix.
For this example I have this matrix :
from=[1 ;2 ;4; 6; 7; 8 ]
Now I want to add x to them so I have
from=[x1;x2;x4;x6;x7;x8]
when I add them, Matlab gave me answers in numbers not in string like this
from=[x1;x2;x4;x6;x7;x8]
tnx againt for your help.
I dont want to use this : from=num2str(from,'x%d') It changes my matrix dimension
so after conversion I have from(1,1)=x from(1,2)=1 I need this : from(1,1)=x1
|
|
0
|
|
|
|
Reply
|
roya
|
5/4/2010 3:13:04 AM |
|
roya olyazadeh wrote:
> Can you tell me how can I add string to a matrix. For this example I
> have this matrix :
>
> from=[1 ;2 ;4; 6; 7; 8 ]
> Now I want to add x to them so I have from=[x1;x2;x4;x6;x7;x8]
> when I add them, Matlab gave me answers in numbers not in string like
> this from=[x1;x2;x4;x6;x7;x8]
>
> tnx againt for your help.
>
>
> I dont want to use this : from=num2str(from,'x%d') It changes my matrix
> dimension
> so after conversion I have from(1,1)=x from(1,2)=1 I need this :
> from(1,1)=x1
The question is what are you proposing to do with the result?
Whether you use a string array or a cell array containing strings, it
_WILL_ be a string/character variable, _NOT_ numeric and it _WILL_ have
different dimensions. Character variables and numeric are two different
things.
What would be most useful representation would depend on the intended
result. If you're intending to make variable names this way, as the FAQ
says, that's not the way to progress in almost all circumstances in
Matlab. If you have something else in mind, it's crystal ball time
unless you're willing to share...
--
--
|
|
0
|
|
|
|
Reply
|
dpb
|
5/4/2010 4:09:39 AM
|
|
|
1 Replies
324 Views
(page loaded in 0.042 seconds)
Similiar Articles: How can I add string to an integer matrix ?? - comp.soft-sys ...Can you tell me how can I add string to a matrix. For this example I have this matrix : from=[1 ;2 ;4; 6; 7; 8 ] Now I want to add x to them so... implementation of atoi - comp.lang.cHow can I add string to an integer matrix ?? - comp.soft-sys ... implementation of atoi - comp.lang.c Hello, I need to convert a large string ... digit between 0 and 9 is ... char to string - comp.soft-sys.matlab... matrix. To do this, i've tried to convert the char array into a string. However, i have not found any command that can do ... How can i add the character ' to a string ... Problem inserting cell array using fastinsert() into mysql ...... StatementObject.setInt(j,tmp) %INTEGER Can anybody please ... the record, we need to convert cell array to matrix ... Size of String Tables - comp.lang.c Problem inserting ... integer overflow in atoi - comp.lang.cTelling whether you can add a digit between 0 and 9 is the easy ... If atoi can be explained in terms of sscanf, then itoa can be ... itoa - converting integer to string ... Sub Pixel Accuracy From Non Integer Values - comp.soft-sys.matlab ...Which you can tell from these images is non integer. ... library covers the following areas: string/integer ... ... lang.asm.x86 Pupils still learn to add ... different size of vectors - comp.soft-sys.matlabHi, how can i add different size of vectors in the same matrix??? e.g. x = ones(1,5); y= ones(1,6); z ... Warning:Size vector should be a row vector with integer ... Converting Certain Data from Numeric Matrix to Text - comp.soft ...... that I will need to convert my numerical matrix to a cell array so I can maintain my integer ... mixed matrix with numerical and string - comp.soft-sys.matlab ... NET ... convert string to ascii - comp.soft-sys.matlabYou can convert a string to a matrix of ASCII values by just wrapping it in double > s ... If int is an integer value the following will give the string: integer'image ... Warning:Size vector should be a row vector with integer elements ...... which will convert to an integer (like floor), or you could add a check that 2/samp_step is an integer ... how to choose random rows from a matrix - comp.soft-sys.matlab ... ... How can I add string to an integer matrix ?? - comp.soft-sys ...Can you tell me how can I add string to a matrix. For this example I have this matrix : from=[1 ;2 ;4; 6; 7; 8 ] Now I want to add x to them so... How can I add string to an integer matrix ?? - Newsreader - MATLAB ...File exchange, MATLAB Answers, newsgroup access, Links, and Blogs for the MATLAB & Simulink user community 7/26/2012 11:58:56 PM
|
|
|
|
|
|
|
|
|