フィルターのクリア

Vector Manipulation - How to achieve this specific form?

2 ビュー (過去 30 日間)
Mathias Dirksmeier
Mathias Dirksmeier 2018 年 10 月 1 日
コメント済み: Star Strider 2018 年 10 月 2 日
Hi all,
I want to receive an expression like this: sos = {[1 8761]' [2 8762]' [3 8763]' [4 8764]' ... [8760 17520]'};
Do you have an idea on how to achieve this?

採用された回答

Star Strider
Star Strider 2018 年 10 月 1 日
Try this:
v1 = 1:17520; % Create Vector
v2 = reshape(v1, [], 2)'; % Reshape Vector To 2-Row Matrix
c = mat2cell(v2, 2, ones(1,size(v2,2))); % Create Cell Array
q1 = v2(:,1:5); % View Original Matrix Sample (Delete Later)
q2 = [c{1:5}] % View Cell Array Sample (Delete Later)
q2 =
1 2 3 4 5
8761 8762 8763 8764 8765
I created separate assignments for clarity. Note that ‘c’ is a (1x8760) cell array, the format requested.
  4 件のコメント
Mathias Dirksmeier
Mathias Dirksmeier 2018 年 10 月 2 日
Perfect! Thanks a lot!!
Star Strider
Star Strider 2018 年 10 月 2 日
As always, my pleasure!

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

その他の回答 (1 件)

Mathias Dirksmeier
Mathias Dirksmeier 2018 年 10 月 1 日
Well, I surely know num2cell...
However, that wasn't the question, was it?
{[1 8761]' [2 8762]' [3 8763]' [4 8764]' ... [8760 17520]'};
How to achieve this specific form?
  1 件のコメント
Mathias Dirksmeier
Mathias Dirksmeier 2018 年 10 月 1 日
Initial response was deleted by user...

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

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by