필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Cell contents reference from a non-cell array object ERROR

조회 수: 3 (최근 30일)
Hamid
Hamid 2014년 12월 15일
마감: MATLAB Answer Bot 2021년 8월 20일
Hi everybody, error occurs in Ed=Ed{j};
I don't know what is it and will be grateful for any suggestion.
Ned=zeros(ne,1);
for i=1:ne
for j=1:lc
Ed=Ed{j};
Ned(i)=bar3s(Ex(i,:),Ey(i,:),Ez(i,:),[E Ep(i,1)],Ed(i,:));
end
end
--------------------------------------------------------------
function [es]=bar3s(ex,ey,ez,ep,ed)
b=[ ex(2)-ex(1); ey(2)-ey(1); ez(2)-ez(1) ];
L=sqrt(b'*b);
n=b'/L; G=[ n zeros(size(n)); zeros(size(n)) n ];
E=ep(1); A=ep(2); Kle=E*A/L*[ 1 -1; 1 1];
N=E*A/L*[-1 1]*G*ed';
es=N;

답변 (1개)

David Sanchez
David Sanchez 2014년 12월 15일
Ed{j} is the content of element j within cell array Ed, and you are trying to assign that value to the cell array itself Ed:
Ed=Ed{j}; %!!!!!
  댓글 수: 2
Hamid
Hamid 2014년 12월 15일
Ed = cell(1, lc);
What should I do David?
David Sanchez
David Sanchez 2014년 12월 15일
You might try something like this:
Ned=zeros(ne,1);
for i=1:ne
for j=1:lc
% Ed=Ed{j}; %%%%%no need for this line
Ned(i)=bar3s(Ex(i,:),Ey(i,:),Ez(i,:),[E Ep(i,1)],Ed{j}(i,:)); % the cell content is plugged with no need of intermediaries
end
end

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by