Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Make NaN value part of matrix

1 回表示 (過去 30 日間)
Ham Man
Ham Man 2020 年 9 月 24 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
I have a 4d velocity matrix in a circular pipe: x,y,z,t
size are as follows:(number of grid points)
x=60,y=60,z=40,t=80
I want to use just 3 planes in x direction and make the remain as a NaN values.
How can I do that?(make just I want to keep 3 planes in x direction.one at the center of pipe,one on top of that and one bottom)

回答 (1 件)

Ameer Hamza
Ameer Hamza 2020 年 9 月 24 日
Do something like this
x_planes = [1 30 60]; % x-planes to keep
M = % 60x60x60x80 matrix
M_new = M*nan;
M_new(x_planes, :, :, :) = M(x_planes, :, :, :)

Community Treasure Hunt

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

Start Hunting!

Translated by