problem with assigning with cell arrays

Ed = cell(1, lc); lc>1
N=A*Ed';
A=[1*6 double]
Ed must be [1*6 double].
for example :
Ed: 1*2 cell= [45*6 double] [45*6 double]
what should I do with these 2 cell??

回答 (1 件)

Orion
Orion 2014 年 12 月 15 日

0 投票

Ed is a cell, you can't operate any mathematical operation on it, only on the elements inside it.
i guess you want to do something like
N1=A*(Ed{1})'; % operation on the 1st element
N2=A*(Ed{2})'; % operation on the 2nd element

4 件のコメント

Hamid
Hamid 2014 年 12 月 15 日
yes you are right but what should I do for a loop (for example if lc=12)?
Orion
Orion 2014 年 12 月 15 日
It depends on what you need :
for example :
for i = 1:Ic
N{i} = A*(Ed{i})';
end
Hamid
Hamid 2014 年 12 月 15 日
the below code is just for Ed double matrix, I want to change it for cell arrays
for i=1:ne
Ned(i)=bar3s(Ex(i,:),Ey(i,:),Ez(i,:),[E Ep(i,1)],Ed(i,:));
end
------------------------------------------------------------
function [es]=bar3s(ex,ey,ez,ep,ed)
N=A*Ed';
es=N;
Thank you dear Orion.
Hamid
Hamid 2014 年 12 月 15 日
the below code is just for Ed double matrix, I want to change it for cell arrays
for i=1:ne
Ned(i)=bar3s(Ex(i,:),Ey(i,:),Ez(i,:),[E Ep(i,1)],Ed(i,:));
end
------------------------------------------------------------
function [es]=bar3s(ex,ey,ez,ep,ed)
N=A*Ed';
es=N;
Thank you dear Orion.

この質問は閉じられています。

タグ

質問済み:

2014 年 12 月 15 日

閉鎖済み:

2021 年 8 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by