Manipulating Character Matrices in Matlab to Operations"

  • Context: MATLAB 
  • Thread starter Thread starter DmytriE
  • Start date Start date
  • Tags Tags
    Matlab Matrices
Click For Summary

Discussion Overview

The discussion revolves around the manipulation of character matrices in Matlab, specifically focusing on the challenges of performing operations on matrices that contain character values. Participants explore alternatives and methods for achieving matrix operations with non-numeric data types.

Discussion Character

  • Technical explanation
  • Homework-related

Main Points Raised

  • One participant inquires about inputting a matrix with characters into Matlab and seeks methods for manipulating it using row operations.
  • Another participant suggests using cell arrays as a potential solution for handling character values in Matlab.
  • A different participant expresses frustration with an error encountered while attempting to multiply a cell array with an identity matrix, indicating that the operation is not supported for cell types.
  • Another suggestion is made regarding the use of symbolic math in Matlab, proposing the use of symbolic variables to create matrices that can be manipulated mathematically.

Areas of Agreement / Disagreement

Participants present multiple approaches to the problem, including the use of cell arrays and symbolic variables, but there is no consensus on the best method to achieve the desired matrix operations with character values.

Contextual Notes

Limitations include the undefined behavior of certain operations on cell arrays and the specific requirements for symbolic math in Matlab, which may not align with the original intent of manipulating character matrices.

DmytriE
Messages
78
Reaction score
0
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.
 
Physics news on Phys.org
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. :mad: I wanted to use this as a check for my homework but I can't. Is there anyway around this error?

Thanks!
 
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}<br /> a & b \\<br /> c & d <br /> \end{vmatrix} = ad - bc[/tex]
you could do:
Code:
syms a b c d real[/color];
det([a b; c d]);
I didn't realize you needed to do matrix arithmetic, so cells won't work.
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 4 ·
Replies
4
Views
7K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 18 ·
Replies
18
Views
6K
  • · Replies 9 ·
Replies
9
Views
4K
  • · Replies 4 ·
Replies
4
Views
2K
Replies
7
Views
2K