フィルターのクリア

Subscript indices must either be real positive integers or logicals.

1 回表示 (過去 30 日間)
Hamid
Hamid 2014 年 8 月 17 日
コメント済み: Hamid 2014 年 8 月 17 日
if true
% code
end
function [Ex,Ey,Ez]=coordxtr(Edof,Coord,Dof,nen)
%[Ex,Ey,Ez]=coordxtr(Edof,Coord,Dof,nen)
%-------------------------------------------------------------
% PURPOSE
% Extract nodal coordinate data from the global coordinate
% matrix for a number of elements with equal number of
% element nodes and dof's.
%
% INPUT: Edof : topology matrix , dim(t)= nie x ned+1
% nie= number of identical elements
% ned= number of element dof's
%
% Coord: global coordinate matrix
%
% Dof: global nodal dof matrix
%
% nen: number of element nodes
%
% OUTPUT: Ex,Ey,Ez : element coordinate matrices
% Ex=[x1 x2 ...xnen; one row for each element
% ... ... ;
% nel ... ]
% dim= nel x nen ; nel:number of elemnts
%-------------------------------------------------------------
% LAST MODIFIED: P-E Austrell 1993-10-14
% Copyright (c) Division of Structural Mechanics and
% Department of Solid Mechanics.
% Lund Institute of Technology
%-------------------------------------------------------------
[nel,dum]=size(Edof);
ned=dum-1;
[n,nsd]=size(Coord);
[n,nd]=size(Dof);
nend=ned/nen;
%
for i = 1:nel
nodnum=zeros(1,nen);
for j = 1:nen
check=Dof(:,1:nend)-ones(n,1)*Edof(i,(j-1)*nend+2:j*nend+1);
[indx,dum]=find(check==0);
if length(indx)>0
nodnum(j)=indx(1);
else
nodnum(j)=0;
end
end
%
Ex(i,:)=Coord(nodnum,1)';
if nsd>1
Ey(i,:)=Coord(nodnum,2)';
end
if nsd>2
Ez(i,:)=Coord(nodnum,3)';
end
end
%--------------------------end--------------------------------
what should I do?
Thank you guys
??? Subscript indices must either be real positive integers or logicals.
Error in ==> coordxtr at 49
Ex(i,:)=Coord(nodnum,1)';

採用された回答

Matt J
Matt J 2014 年 8 月 17 日
In MATLAB indexing starts at 1, not 0, so setting nodnum to zero
nodnum(j)=0;
doesn't make sense if you are going to be indexing with it.
  2 件のコメント
Matt J
Matt J 2014 年 8 月 17 日
編集済み: Matt J 2014 年 8 月 17 日
Aside from that, it is appropriate that you invest some time reading about the DBSTOP command and other MATLAB debugging tools.
Most of the questions in your profile are simply requests for the forum to do basic debugging for you. That's not what it's for. The problems you've been having are easily troubleshot using the above referenced tools.
Hamid
Hamid 2014 年 8 月 17 日
thanks

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeString Parsing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by