how do i write a function that splits a 16x1 matrix into a 4x4 matrix

回答 (2 件)

Youssef  Khmou
Youssef Khmou 2013 年 9 月 5 日

0 投票

Use reshape as mentioned by @Image Analyst , or use standard method :
function Y=split16144(X)
Y=zeros(4,4);
ctr=1;
for x=1:4
for y=1:4
Y(x,y)=X(ctr);
ctr=ctr+1;
end
end

カテゴリ

ヘルプ センター および File ExchangeProblem-Based Optimization Setup についてさらに検索

質問済み:

2013 年 9 月 5 日

Community Treasure Hunt

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

Start Hunting!

Translated by