How to cut and reshape values?

1 次查看(过去 30 天)
out =
Columns 1 through 5
90 90 -45 0 0
90 90 -45 0 0
90 90 -45 0 0
90 90 -45 0 45
90 90 0 0 45
90 -45 0 0 45
Columns 6 through 9
45 45 0 -45
45 45 -45 0
45 0 -45 45
45 0 -45 0
45 0 -45 -45
45 0 -45 90
i want to reshape it into layer
layer = reshape(layer',size(layer,2),1,size(layer,1))
but i'm getting vertical...but i need horizontal
& I want only last 5 layer Means
layer(:,:,1) = [90 90 -45 0 0 45 45 -45 0];
layer(:,:,2) = [90 90 -45 0 0 45 0 -45 45] and so on....

采纳的回答

Andrei Bobrov
Andrei Bobrov 2016-1-26
编辑:Andrei Bobrov 2016-1-26
layer1 = reshape(layer(2:end,:)',1,size(layer,2),5)
  5 个评论
Andrei Bobrov
Andrei Bobrov 2016-1-26
Hey Walter! I agree with you, I corrected the answer.
Triveni
Triveni 2016-1-26
layer1 = reshape(layer(2:end,:)',1,size(layer,2),(size(layer,1)-1));
Thanks it's works for all type.

请先登录,再进行评论。

更多回答(1 个)

Walter Roberson
Walter Roberson 2016-1-26
layer = permute(out, [2 3 1])
  3 个评论
Triveni
Triveni 2016-1-26
Andrei's answers is works. Your code I've tried earlier too.... it's giving vertical...& i need horizontal.
Thank you Sir....You help lot not only me..everyone.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by