Combine arrays

9 ビュー (過去 30 日間)
Kris
Kris 2012 年 6 月 12 日
In order to visualise my simulation i want to plot some results. During my simulation i created multiple arrays of the size= 96x1, 96x3, 96x5.
Want i want to achieve is to combine these arrays into a single 96x9 array as i see no other way to plot them all into one graph.
Can anyone help? :
Thank you,
Kris

採用された回答

Kye Taylor
Kye Taylor 2012 年 6 月 12 日
@Sean's answer is great. (That's my vote up there...)
To suggest other ways to plot arrays on the same axis, try
Approach 1)
figure, hold on
plot(x1)
plot(x2)
plot(x3)
Approach 2.)
plot(1:length(x1),x2,1:length(x2),x2,1:length(x3),x3)
  2 件のコメント
Kris
Kris 2012 年 6 月 12 日
@kyle, the first one works. The only pain is that it actually creates a plot for each step. So i've got 96 plots atm :p. Can this be edited that it deletes the plot of the previous step? :p
Sean de Wolski
Sean de Wolski 2012 年 6 月 12 日
don't hold on
figure;
plot(x1)
Now either make a new figure and plot(x2) or just call plot(x2) and plot(x1) will be overwritten.

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

その他の回答 (2 件)

Sean de Wolski
Sean de Wolski 2012 年 6 月 12 日
Xcat = [x1 x2 x3];
do_stuff_with(Xcat)
  1 件のコメント
Kris
Kris 2012 年 6 月 12 日
Doesn't work :s
i've created the arrays like this :
V(a,1) = result1
Q(a:)= result2,3,4
i want V and Q to appear on the same graph

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


Kris
Kris 2012 年 6 月 12 日
@Kyle and Sean, thx for the very fast answer!
Kyle's second method works for my case. I can plot all variables now!
grattitude!
:)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by