フィルターのクリア

to convert a row into 3d matrix having all combinations

3 ビュー (過去 30 日間)
ABDUL
ABDUL 2018 年 2 月 7 日
コメント済み: Matt J 2018 年 2 月 8 日
i have a piece of code p=[1 -1 1j -1j] i want to convert this 1x4 matrix into 256X4x2 matrix. how to fix this bug .
  2 件のコメント
Guillaume
Guillaume 2018 年 2 月 7 日
what should go into those 256x2 entries? What bug?
ABDUL
ABDUL 2018 年 2 月 7 日
how to convert it into 256x4x2 matrix

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

回答 (2 件)

Matt J
Matt J 2018 年 2 月 7 日
編集済み: Matt J 2018 年 2 月 7 日
You've left us to do a lot of guessing as to what you want, but here's my guess,
[c{1:4}]=ndgrid(p);
result=reshape(cell2mat(c),256,4);

Ahmed Mahfouz
Ahmed Mahfouz 2018 年 2 月 7 日
i don't know what you exactly mean but i assumed the entries to the 3d matrix are the same as in the given vector, you can try the following code:
p=[1 -1 1j -1j];
for n=1:256
Matrix(n,:)=p;
end
Matrix(:,:,2)=Matrix(:,:,1);
  10 件のコメント
ABDUL
ABDUL 2018 年 2 月 8 日
if i want to retain the same size of 512x4 what do i have to modify.
Matt J
Matt J 2018 年 2 月 8 日
B=cat(1,result,result);

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

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by