📄 gcd1.m
字号:
function res = gcd1(a)% DESCRIPTION res = gcd1(a)% Greatest common divisor for each column of any non empty matrix% with integer values. % INPUT% a -- Any non integer matrix.% OUTPUT% res -- A vector with one element for each column,% containing the greatest common divisor for that column.% TRY% gcd1([5; 30]) or gcd1([2*3*4 3*5 2*3]')% SEE ALSO% gcd % by Magnus Almgren 991101if isempty(a) res = a; returnendr = a(1,:); for i = 1:size(a,1); r = gcd(r,a(i,:));endres = reshape(r,size(a(1,:)));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -