How about matlab size function ?
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Mohamed Gharbi
am 4 Mär. 2023
Kommentiert: Voss
am 5 Mär. 2023
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 Kommentare
Akzeptierte Antwort
Matt J
am 4 Mär. 2023
Bearbeitet: Matt J
am 4 Mär. 2023
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 Kommentare
Voss
am 5 Mär. 2023
@Mohamed Gharbi: Please click the "Accept This Answer" button on Matt J's answer.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Operating on Diagonal Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!