getting errors in running this.
1 回表示 (過去 30 日間)
古いコメントを表示
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
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.
回答 (1 件)
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;
参考
カテゴリ
Help Center および File Exchange で Resizing and Reshaping Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!