getting errors in running this.

조회 수: 1 (최근 30일)
Chaudhary P Patel
Chaudhary P Patel 2020년 1월 21일
댓글: Chaudhary P Patel 2020년 1월 21일
dmp = M.data.damping;
c=damp(:,:);
Dot indexing is not supported for variables of this type.
Error in Untitled (line 13)
dmp = M.data.damping; %% damping matrix of the structure
  댓글 수: 2
Guillaume
Guillaume 2020년 1월 21일
Your code expect M or M.data to be something that can be indexed with ., possibly a structure. The error message tells you it isn't.
The problem is earlier in your code, wherever M or M.data is created.
Chaudhary P Patel
Chaudhary P Patel 2020년 1월 21일
편집: Guillaume 2020년 1월 21일
%%% this is my code initiation part%%%%%%%%%
inpf=input('File name of input file data ','s');
M=importdata([inpf,'.xlsx']);
%Table of nodes and coordinates of column
nod=M.data.Node;
nj=max(nod(:,1));% No. of joints or nodes
%Table of elments of column core and beam
elem=M.data.Element; %Elelment data for Column
ne=max(elem(:,1)); %No. of elements
stif=M.data.Stiffness; %% stiffness matrix of the structure
K=stif(:,:);
mas=M.data.Mass; % mass matrix of the structure
M=mas(:,:);
dmp = M.data.damping; %% damping matrix of the structure
C=dmp(:,:);

댓글을 달려면 로그인하십시오.

답변 (1개)

Guillaume
Guillaume 2020년 1월 21일
I would recommend you use readtable instead of importdata. importdata may not return what you expected if the file format change. However, it is not the problem here.
M.data is indeed a structure ... until you stomp on it and replace it with a matrix:
M=mas(:,:);
From this point onward, you've replaced the original M so of course, M.data.damping no longer work.
Morale of the story: Use better variable names, ones that are not ambiguous, so you know what they actually contain. I would recommend using complete words with no abbreviation, e.g. importeddata instead of M, mass instead of the other M, stiffness, damping, etc.
Also note, that
X = Y(:, :);
when Y is a 2D matrix is just a more complicated and confusing way of writing:
X = Y;
  댓글 수: 1
Chaudhary P Patel
Chaudhary P Patel 2020년 1월 21일
thank you so much sir!!!

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Cell Arrays에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by