row of all 8’s
1 回表示 (過去 30 日間)
古いコメントを表示
Chung Di
2017 年 11 月 23 日
コメント済み: Kaushik Lakshminarasimhan
2017 年 11 月 24 日
Suppose O=ones(n) Now how can I insert a row of all 8’s between rows (n-3) and (n-2) of matrix O and insert a column of all 8’s between columns 1 and 2 of matrix )
0 件のコメント
採用された回答
Kaushik Lakshminarasimhan
2017 年 11 月 23 日
編集済み: Kaushik Lakshminarasimhan
2017 年 11 月 24 日
N = 10;
X = ones(N); % create a matrix of 1s
X = [X(1:N-3,:) ; 8*ones(1,N) ; X(N-2:end,:)]; % add a row of 8s between (N-3)th and (N-2)th row
X = [X(:,1) 8*ones(N+1,1) X(:,2:end)]; % add a column of 8s between 1st and 2nd columns
9 件のコメント
Kaushik Lakshminarasimhan
2017 年 11 月 24 日
I didn't add comments because I thought it was self-explanatory. Anyway, I have edited my answer to include comments.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!