フィルターのクリア

matrix whose cell arrays are vectors

1 回表示 (過去 30 日間)
Mehdi
Mehdi 2017 年 3 月 31 日
回答済み: the cyclist 2017 年 3 月 31 日
Hi,
I am trying to form a 5x20 matrix whose arrays are themselves 3x1 matrix (x(i), y(i), z(i)) in each row:
x = zeros(1, 20);
y = -47.5 : 5: -32.5;
z = (22.5 :-5: 12.5)';
z is a 5x1 matrix which is the same in each column.
How do I do that?
Thank you!
  2 件のコメント
Jan
Jan 2017 年 3 月 31 日
Wow, this is a complicated question. The terms "matrix", "cell", "array" and "vector" are wildly mixed.
The problem might get clear, if you use the standard Matlab names: Only cell arrays are "cells". "Matrices" are 2D "arrays". "Vectors" are [1 x N] or [N x 1] arrays (and matrices).
Currently I do not get, what you are looking for.
Tushar Agarwal
Tushar Agarwal 2017 年 3 月 31 日
Hello - If you could clearly tell what your issue is? It was a little difficult to understnad what you seek to find

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

採用された回答

the cyclist
the cyclist 2017 年 3 月 31 日
I am going to try to take my best guess at what you mean. At the very least, you will see one way to structure this.
% Your example contents
x = zeros(1, 20);
y = -47.5 : 5: -32.5;
z = (22.5 :-5: 12.5)';
% Define the highest-level cell array
M = cell(5,20);
% Define that the first cell of M contains a 1x3 cell array
M{1,1} = cell(1,3);
% Fill each of the three cells with its contents
M{1,1}{1} = x;
M{1,1}{2} = y;
M{1,1}{3} = z;
This is all probably a terrible way of organizing whatever data you have.

その他の回答 (0 件)

カテゴリ

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

製品

Community Treasure Hunt

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

Start Hunting!

Translated by