fitsize.m v1 (Jan 2014)

Forces arrays to have the same size by replications of the singleton dimensions.
다운로드 수: 255
업데이트 날짜: 2014/1/3

라이선스 보기

Yes, now there exist ARRAYFUNC and others functions that automatically expand the singleton dimensions of the inputs, but they don't work correctly with multiple arrays of different sizes. Besides, you don't get the expanded arrays, only the result.

So, this FITSIZE function expands your arrays so they all have the same size, and then you can use it in any function you want.

If the arrays sizes cannot be fitted like in
size(x) = [1 2 3]
size(y) = [4 2 5] :(
where the last dimension are non-singleton and different, and ERROR is thrown.

One should have something like
size(a) = [1 2 1]
size(b) = [4 2 5]
size(c) = [4 1]
size(d) = [1 2] :)
and with
>> [A,B,C,D] = fitsize(a,b,c,d);
you'll get
size(A) = [4 2 5]
size(B) = [4 2 5]
size(C) = [4 2 5]
size(D) = [4 2 5].

Because it uses REPMAT, it supports different inputs types like numerics, structures, chars, cells, etc.

Finally, when a single output is used, all fitted arrays are packed in a cell, like in the screenshot.

Enjoy it!

인용 양식

Carlos Adrian Vargas Aguilera (2024). fitsize.m v1 (Jan 2014) (https://www.mathworks.com/matlabcentral/fileexchange/44904-fitsize-m-v1-jan-2014), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2013a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
버전 게시됨 릴리스 정보
1.0.0.0