Subscript indices must either be real positive integers or logicals.

5 Ansichten (letzte 30 Tage)
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)';

Akzeptierte Antwort

Matt J
Matt J am 17 Aug. 2014
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 Kommentare
Matt J
Matt J am 17 Aug. 2014
Bearbeitet: Matt J am 17 Aug. 2014
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.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by