How about matlab size function ?
4 ビュー (過去 30 日間)
古いコメントを表示
Why is the size of matrix b different from the size of matrix a?
Please, any suggestions? How to fix it
________________________
a = testSizeFunction
[M,N] = size(a)
b = rand(size(a))
0 件のコメント
採用された回答
Matt J
2023 年 3 月 4 日
編集済み: Matt J
2023 年 3 月 4 日
You have not overloaded the size method appropriately for the case where nargout=1:
a = testSizeFunction;
siz=size(a)
Try this instead:
function varargout = size(obj,varargin)
[varargout{1:nargout}] = builtin('size', obj.s, varargin{:}); % call builtin size function
end
6 件のコメント
Voss
2023 年 3 月 5 日
@Mohamed Gharbi: Please click the "Accept This Answer" button on Matt J's answer.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Operating on Diagonal Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!