multiplying a value and create a matrix of a certain size
2 ビュー (過去 30 日間)
古いコメントを表示
The outcome of this line
B=strcat(num2str(i),',',str3);
is B =4,1,1. I would like to multiply B and create a matrix (a column vector) with the same size as data1 (which is a 748*3 matrix) so that I could create a new matrix like newMatrix=[data1 B] later on . Thank you.
7 件のコメント
Image Analyst
2018 年 6 月 30 日
B is the name of a character vector and is '41,1' -- it is not a matrix, and does not have value of 'data1, 848*3'. I think your terminology is confusing everybody.
I don't know what "each piece of data" is but why do you need a new, unique name for each piece?
Please answer my questions in Walter's answer also.
回答 (1 件)
Walter Roberson
2018 年 6 月 30 日
repmat(B, size(data1, 1), 1)
However if data1 is numeric then [data1 replicated_B] is unlikely to give you what you expect.
参考
カテゴリ
Help Center および File Exchange で Structures についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!