Clear Filters
Clear Filters

getting errors in running this.

1 view (last 30 days)
Chaudhary P Patel
Chaudhary P Patel on 21 Jan 2020
Commented: Chaudhary P Patel on 21 Jan 2020
dmp =;
Dot indexing is not supported for variables of this type.
Error in Untitled (line 13)
dmp =; %% damping matrix of the structure
Guillaume on 21 Jan 2020
Your code expect M or 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 is created.
Chaudhary P Patel
Chaudhary P Patel on 21 Jan 2020
Edited: Guillaume on 21 Jan 2020
%%% this is my code initiation part%%%%%%%%%
inpf=input('File name of input file data ','s');
%Table of nodes and coordinates of column;
nj=max(nod(:,1));% No. of joints or nodes
%Table of elments of column core and beam; %Elelment data for Column
ne=max(elem(:,1)); %No. of elements; %% stiffness matrix of the structure
K=stif(:,:);; % mass matrix of the structure
dmp =; %% damping matrix of the structure

Sign in to comment.

Answers (1)

Guillaume on 21 Jan 2020
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. is indeed a structure ... until you stomp on it and replace it with a matrix:
From this point onward, you've replaced the original M so of course, 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;


Find more on Cell Arrays in Help Center and File Exchange


Community Treasure Hunt

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

Start Hunting!