Struct contents reference from a non-struct array object. for importing file

2 ビュー (過去 30 日間)
Taehun Kim
Taehun Kim 2017 年 7 月 16 日
コメント済み: Taehun Kim 2017 年 7 月 16 日
lab4_plot_data.txt is 2x100 double
X=importdata('lab4_plot_data.txt')
x=X.data(1,:); y=X.data(2,:);
error message is "Struct contents reference from a non-struct array object. Error in lab4t2 (line 7) x=X.data(1,:); "

採用された回答

Image Analyst
Image Analyst 2017 年 7 月 16 日
You forgot to attach lab4_plot_data.txt, but my guess is that X is just a regular 2-d array of numbers, so you'd do
x = X(1, :); % x is row 1 of the data
y = X(2, :); % y is row 2 of the data
Try that and attach lab4_plot_data.txt if it doesn't work.
  1 件のコメント
Taehun Kim
Taehun Kim 2017 年 7 月 16 日
found problem hahaha lab4_plot_data.txt has got problem because they had space between elements

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by