mis match matrix dimension
古いコメントを表示
Hi
Consider the example and propose a solution to the dimension mismatch.
Thank you very much
a = zeros(15,41);
b = ones(1,2);
for i = 1:length(a)
a(:,i) = b;
end
6 件のコメント
KSSV
2023 年 3 月 28 日
What you are trying to do?
Life is Wonderful
2023 年 3 月 28 日
Dyuman Joshi
2023 年 3 月 28 日
In what manner do you want to copy the content of b into a?
Life is Wonderful
2023 年 3 月 28 日
編集済み: Life is Wonderful
2023 年 3 月 28 日
Dyuman Joshi
2023 年 3 月 28 日
編集済み: Dyuman Joshi
2023 年 3 月 28 日
"The issue is that after the third iteration, the b matrix is surpassed."
Can you explain what do you mean this?
"How to transform a matrix 1 x 2 to a 15 x 41 ?"
Since the dimensions of b are not multiple of the dimensions of a, it is not possible to transform (or replicate in any manner) b into a. Though you can replicate to nearest dimension and crop the required size.
a = zeros(15,41);
b = [1 2];
What is the expected output for the above data?
Life is Wonderful
2023 年 3 月 29 日
採用された回答
その他の回答 (1 件)
Nithin Kumar
2023 年 3 月 28 日
編集済み: Nithin Kumar
2023 年 3 月 28 日
0 投票
Hi,
I understand that you are trying to assign matrix "b" to matrix "a" where the order of matrices are not the same. You can apply assignment operation on matrices when they are of the same order.
Additionally, you can apply assignment operation on matrices if at least one of the two dimensions of both the matrices are equal using concatenation.
For more information on the matrix dimensions, kindly refer the following link Creating, Concatenating, and Expanding Matrices - MATLAB & Simulink - MathWorks India
I hope this answer resolves the issue you are encountering.
1 件のコメント
Life is Wonderful
2023 年 3 月 28 日
編集済み: Life is Wonderful
2023 年 3 月 29 日
カテゴリ
ヘルプ センター および File Exchange で Matrix Indexing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!