cell symbolic matrix into simple symbolic matrix

Hello all,
I am having a cell of 3d symbolic object matrix, but I need to convert this matrix into simple symbolic matrix.
I tried using 'cell2mat' function but it is not helping as this function doesn't help when cell contains symbolic objects.
I need to convert into simple matrix as, I need to perform some multiplication operation on simple matrix, which is not possible if it is in cell form.
Can anyone help me, in this regard.

4 Comments

give a simple example of his cell arrays
lets say: A is a 3d cell matrix of symbolic objects as you mentioned in the previous question using walter'd idea, now
x = sym(0);
A(1:4,1,1:4) = [ {x} {x} {x} {x};
{x} {x} {x} {x};
{x} {x} {x} {x};
{x} {x} {x} {x} ];
Now what I need to do perform some matrix multiplication etc. on this said matrix, so I need to convert it into simple matrix as multiplication addition is not defined in cell matrix, now when I used cell2mat it doesn't work as this function can't convert cell into matrix which have symbolic objects in them.
that is the simplest example I can come up with, hoping it would make my problem clear :)
duplicate is at http://www.mathworks.com/matlabcentral/answers/19745-converting-a-cell-symbolic-matrix-into-simple-symbolic-matrix
hey walter it is, and sorry for that, i didn't know the pattern about how this forum works, so I thought I must create a duplicate for making it visible to all.. :), but now i know

Sign in to comment.

 Accepted Answer

>> x = sym(0);
A(1:4,1,1:4) = [ {x} {x} {x} {x};
{x} {x} {x} {x};
{x} {x} {x} {x};
{x} {x} {x} {x} ]
A(:,:,1) =
[1x1 sym]
[1x1 sym]
[1x1 sym]
[1x1 sym]
A(:,:,2) =
[1x1 sym]
[1x1 sym]
[1x1 sym]
[1x1 sym]
A(:,:,3) =
[1x1 sym]
[1x1 sym]
[1x1 sym]
[1x1 sym]
A(:,:,4) =
[1x1 sym]
[1x1 sym]
[1x1 sym]
[1x1 sym]
>> A1 = squeeze(A)
A1 =
[1x1 sym] [1x1 sym] [1x1 sym] [1x1 sym]
[1x1 sym] [1x1 sym] [1x1 sym] [1x1 sym]
[1x1 sym] [1x1 sym] [1x1 sym] [1x1 sym]
[1x1 sym] [1x1 sym] [1x1 sym] [1x1 sym]
>> A2 = reshape([A{:}],size(A1))
A2 =
[ 0, 0, 0, 0]
[ 0, 0, 0, 0]
[ 0, 0, 0, 0]
[ 0, 0, 0, 0]
>>

2 Comments

the final obtained A2 is matrix of symbolic objects ?
awesome andrei, thanks a lot.....

Sign in to comment.

More Answers (0)

Categories

Find more on Operators and Elementary Operations in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!