Converting a cell symbolic matrix into simple symbolic matrix
Show older comments
Hello all,
I am having a problem, in which 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.
I shall be thankful.
Best regards,
Alok Singh
Answers (1)
Andrei Bobrov
on 29 Oct 2011
about symbolic value 3d
used ideas by Walter Roberson
[x y z] = ndgrid(1:10,1:10,1:10);
k = regexp(sprintf('A%-d_%-d_%-d ',[x(:),y(:),z(:)]'),' ','split');
k = cellfun(@sym,k(1:end-1),'un',0);
A = reshape([k{:}],size(x))
answer on your question
k - array cell with symbolic value
out = reshape([k{:}],size(k))
Categories
Find more on Common 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!