Assigning between unlike types such as matrix and cell is not allowed in Matlab. The error message that you may encounter is similar to the following:
main.m55 chars2 lines
In Matlab, each variable can be of a particular type, which can be either:
double, single, and int8.true or false.To assign values between unlike types in Matlab, you need to convert them to compatible types first. For example, if you have a matrix and want to assign it to a cell array, you need to convert the matrix to a cell array first:
main.m141 chars9 lines
Alternatively, if you have a cell array and want to assign it to a matrix, you can convert the cell array to a matrix first. However, this only works if all elements in the cell array are numeric:
main.m149 chars9 lines
Note that in some cases, you may also need to reshape or transpose the variables to make them compatible before assignment.
gistlibby LogSnag