フィルターのクリア

Very beginner question: plot excel via scatter3d but getting error

1 回表示 (過去 30 日間)
vapeur
vapeur 2017 年 5 月 21 日
コメント済み: Star Strider 2017 年 5 月 21 日
Hi there, I've tried to plot a set of data (188 points from a table 188*3) using scatter3d, and codes are below.
x=data01(:,1);
y=data01(:,2);
z=data01(:,3);
scatter3(x,y,z);
and my x value is a list of 188 numbers of x-coordinate(purely number), and it is a table with 188*1.
It is very simple, but I continued got error saying 'input arguments must be numeric, datetime, duration or categorical'. I cannot find solution...and it kills half of my day..would somebody like to help? Thanks.

採用された回答

Walter Roberson
Walter Roberson 2017 年 5 月 21 日
Because your data01 is a table, you need to extract the content of the table.
x=data01{:,1};
y=data01{:,2};
z=data01{:,3};
scatter3(x,y,z);
Or if you know the variable names you could use them. For example if the variable names in the table are Lat, Lon, Alt, then you could code
x = data01.Lat;
y = data01.Lon;
z = data01.Alt;
scatter3(x,y,z);
  1 件のコメント
vapeur
vapeur 2017 年 5 月 21 日
Thanks! I just knew from you that the curly braces can do what parenthesis cannot..

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

その他の回答 (1 件)

Star Strider
Star Strider 2017 年 5 月 21 日
You need to use cell array addressing.
This works:
figure(1)
scatter3(data01{:,1}, data01{:,2}, data01{:,3})
Note the curly braces ‘{}’ denoting cell array addressing.
  2 件のコメント
vapeur
vapeur 2017 年 5 月 21 日
Thanks!
Star Strider
Star Strider 2017 年 5 月 21 日
Our pleasure!

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

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by