Matlab character matrices


by DmytriE
Tags: character, matlab, matrices
DmytriE
DmytriE is offline
#1
Feb20-12, 05:37 PM
P: 75
Hi everyone,

I am wondering if I can input a matrix into Matlab that contains characters. I then would like to manipulate the matrix using row changing operations. Matlab, however, will not allow me to create a matrix with letters. Is there an equivalent to a matrix for character values that can have operations performed on them?

Thanks.
Phys.Org News Partner Science news on Phys.org
SensaBubble: It's a bubble, but not as we know it (w/ video)
The hemihelix: Scientists discover a new shape using rubber bands (w/ video)
Microbes provide insights into evolution of human language
jhae2.718
jhae2.718 is offline
#2
Feb21-12, 12:08 AM
PF Gold
jhae2.718's Avatar
P: 1,153
You may want to look into using a cell: http://www.mathworks.com/help/techdoc/ref/cell.html
DmytriE
DmytriE is offline
#3
Feb21-12, 06:37 AM
P: 75
Maybe I'm using cells incorrectly, but to test I am multiplying a 4x4 matrix / array with the 4x4 identity. It should return the original matrix / array. However, I get an error message that won't allow me to perform the operation.

"??? Undefined function or method 'mtimes' for input arguments of type 'cell'.

This is irritating. I wanted to use this as a check for my homework but I can't. Is there anyway around this error?

Thanks!

jhae2.718
jhae2.718 is offline
#4
Feb21-12, 07:58 AM
PF Gold
jhae2.718's Avatar
P: 1,153

Matlab character matrices


Are you just trying to do symbolic math with matrices? You can use sym or the shortcut syms to create symbolic variables and then create a matrix using them. E.g. for something like
[tex]
\begin{vmatrix}
a & b \\
c & d
\end{vmatrix} = ad - bc
[/tex]
you could do:
syms a b c d real;
det([a b; c d]);
I didn't realize you needed to do matrix arithmetic, so cells won't work.


Register to reply

Related Discussions
matlab inline functions character replacement Math & Science Software 0
What are the meaning of monopole character and dipole character? Special & General Relativity 2
Get the contents of a file, character by character Programming & Computer Science 7
matrices in matlab Math & Science Software 2
Matrices in Matlab Math & Science Software 5