フィルターのクリア

How to create 2D plot from 3D table?

2 ビュー (過去 30 日間)
Parthiban C
Parthiban C 2017 年 12 月 27 日
回答済み: Benjamin Kraus 2017 年 12 月 27 日
I have n number of 2d tables. Each table is for different time point. I did concatenate of all the 2d tables and made it as 3d. Now I want to take first data from all the table and need to plot vs time. Similarly all the second data and so on.
Example: Let's call 2d table as A, B, C...Now I want to create plot connecting A(1,1), B(1,1), C(1,1)....Similarly for all other points also. Can someone please help with me?
  1 件のコメント
Benjamin Kraus
Benjamin Kraus 2017 年 12 月 27 日
Can you clarify your question. When you say "table", are you referring to a MATLAB table object? Those do not support 3D. Or are you referring to a 2D matrix?

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

回答 (1 件)

Benjamin Kraus
Benjamin Kraus 2017 年 12 月 27 日
Assuming you are referring to 2D matrices, which you have concatenated into a 3D matrix (MATLAB table objects do not support 3D), you can plot like this:
Z = cat(3,A,B,C);
plot(Z(1,1,:))
Alternatively, you can use reshape:
Z = cat(3,A,B,C);
Z = reshape(Z,numel(A),[])';
plot(Z)

カテゴリ

Help Center および File ExchangeGraphics Object Programming についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by