How to create 3d matrix from the 2d matrix?

5 ビュー (過去 30 日間)
Lilya
Lilya 2018 年 9 月 12 日
編集済み: KSSV 2018 年 9 月 12 日
Hi all,
I have a matrix of 251*27 dimension, that I want to store it in the new 3d one that has a dimension of 251*27*10. it means that each third dimension of the 10th should have 251*27. the command that I use which is not correct is :
the dim of geov is (251,27);
gridpav = nan(size(geov));
for i = 1:10
gridpav (:,:,i) = pav(i);
end
thanks for the help.

採用された回答

KSSV
KSSV 2018 年 9 月 12 日
A = rand(3,4) ;
B = repmat(A,1,1,10) ;
  3 件のコメント
Lilya
Lilya 2018 年 9 月 12 日
sorry but i have another question if that possible, i am also using the previous command to apply pcolor for the data. which means having individual plots from 1 to 10 with the data of x-axis: gridlonv, y-axis: gridpav, colored data: geov
for example transect numbe 5:
pcolor(gridlonv(:,:,5),-gridpav (:,:,5),geov(:,:,5))
but the figure shows nothing!
thanks again for the help.
KSSV
KSSV 2018 年 9 月 12 日
編集済み: KSSV 2018 年 9 月 12 日
It should show values, if the dimensions are obeyed....do they have any NaN's?

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by