size() function returns wrong size
6 ビュー (過去 30 日間)
古いコメントを表示
danielle sisserman
2020 年 11 月 7 日
コメント済み: danielle sisserman
2020 年 11 月 7 日
i have the following line of code:
s = size(k_distances)
k_distances is a 1x1 matrix:

but the size function returns a size of 1x2:

and then:
k_labels = zeros(s);
returns a 3x1 matrix that not all zeros!!

any idea what is happening?
thank you
4 件のコメント
採用された回答
Mario Malic
2020 年 11 月 7 日
k_labels should return 1x1 array with value of zero.
Did you clear workspace from previous runs?
From the documentation on function size
sz = size(A) returns a row vector whose elements are the lengths of the corresponding dimensions of A. For example, if A is a 3-by-4 matrix, then size(A) returns the vector [3 4].
If A is a table or timetable, then size(A) returns a two-element row vector consisting of the number of rows and the number of table variables.
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Characters and Strings についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!