ELEMENTS IN ODD COLUMNS AND ROWS
1 回表示 (過去 30 日間)
古いコメントを表示
Hello dear friends, I ask you for help with this exercise:
Develop a function called imp_index that takes an array M as input argument and returns an array containing the elements of M that are in the odd columns and rows.
Thanks for your help
So far I have developed this code:
function out = imp_index(M)
M=A(1:2:end,1:2:end);
M=A(1:2:end,2:2:end);
M=A(2:2:end,1:2:end);
M=A(2:2:end,2:2:end);
end
0 件のコメント
回答 (1 件)
David Hill
2022 年 12 月 6 日
M=randi(100,10)
out=imp_index(M)
function out = imp_index(M)
out=M(1:2:end,1:2:end);
out=out(:)';
end
4 件のコメント
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!