Fix. Default password should be [] not an empty string
line source
mc
%% Some AOs
c1 = ao(1); c1.setName;
c2 = ao(2); c2.setName;
c3 = ao(3); c3.setName;
c4 = ao(randn(3,3)); c4.setName;
c5 = ao(randn(3,3)); c5.setName;
c6 = ao(randn(3,1)); c6.setName;
c7 = ao(randn(1,3)); c7.setName;
t1 = ao(plist('tsfcn', 't', 'fs', 10, 'nsecs', 10)); t1.setName;
t2 = ao(plist('tsfcn', 'sqrt(t)', 'fs', 10, 'nsecs', 10)); t2.setName;
t3 = ao(plist('tsfcn', 't.^2', 'fs', 10, 'nsecs', 10)); t3.setName;
f1 = ao(plist('fsfcn', 'f', 'f', 'logspace(-4,1,100)')); f1.setName;
f2 = ao(plist('fsfcn', '1./f', 'f', 'logspace(-4,1,100)')); f2.setName;
f3 = ao(plist('fsfcn', 'sqrt(f)', 'f', 'logspace(-4,1,100)')); f3.setName;
x1 = ao(plist('xyfcn', 'x', 'x', '1:100')); x1.setName;
x2 = ao(plist('xyfcn', '1./x', 'x', '1:100')); x2.setName;
x3 = ao(plist('xyfcn', 'sqrt(x)', 'x', '1:100')); x3.setName;
%% Rule 1
%---------- CDATA
% cdata .* cdata
r1 = rdivide(c1,c3);
% cdata .* tsdata
r2 = rdivide(c1,t1);
% cdata .* fsdata
r3 = rdivide(c1,f1);
% cdata .* xydata
r4 = rdivide(c1,x1);
%---------- TSDATA
% tsdata .* tsdata
r5 = rdivide(t1, t2);
% tsdata .* fsdata
try
r6 = rdivide(t1, f2);
error('Data types should be incompatible: booo!');
catch
lasterr
warning('Data types not compatible: fsdata.*tsdata: hoorah!');
end
% tsdata .* xydata
r7 = rdivide(t1, x2);
% tsdata .* cdata
r8 = rdivide(t1, c2);
%---------- FSDATA
% fsdata .* tsdata
try
r9 = rdivide(f1, t2);
error('Data types should be incompatible: booo!');
catch
lasterr
warning('Data types not compatible: fsdata.*tsdata: hoorah!');
end
% fsdata .* fsdata
r10 = rdivide(f1, f2);
% fsdata .* xydata
r11 = rdivide(f1, x2);
% fsdata .* cdata
r12 = rdivide(f1, c2);
%---------- XYDATA
% xydata .* tsdata
r13 = rdivide(x1, t2);
% xydata .* fsdata
r14 = rdivide(x1, f2);
% xydata .* xydata
r15 = rdivide(x1, x2);
% xydata .* cdata
r16 = rdivide(x1, c2);
%% Rule 2: vector .* single
v = [t1 t2];
s = c2;
% one output
r1 = rdivide(v,s)
r2 = rdivide(s,v)
% multiple outputs
[r1 r2] = rdivide(v,s)
%% Rule 3: V_N .* V_M
v1 = [t1 t2];
v2 = [c1 c2 c3];
try
r = rdivide(v1,v2);
error('Rule 3 should fail: booo!');
catch
lasterr
warning('Rule 3 fails: hoorah!');
end
%% Rule 4: V_N .* U_N
v1 = [t1 t2 t3];
v2 = [x1 x2 x3];
r = rdivide(v1,v2);
[r1 r2 r3] = rdivide(v1,v2);
%% Rule 5: matrix .* single
m = [t1 t2 t3; x1 x2 x3];
s = c2;
r1 = rdivide(m,s);
r2 = rdivide(s,m);
%% Rule 6: matrix .* column vector
m = [t1 t2 t3; x1 x2 x3];
v = [c1; c2];
r1 = rdivide(m,v)
r2 = rdivide(v,m)
%% Rule 7: matrix .* row vector
m = [t1 t2 t3; x1 x2 x3];
v = [c1 c2 c3];
r1 = rdivide(m,v)
r2 = rdivide(v,m)
%% Rule 8: M_NP .* V_1Q (or V_Q1)
m = [t1 t2 t3; x1 x2 x3];
v = [c1 c2];
try
r = rdivide(m,v)
error('Rule 8 should fail: booo!');
catch
lasterr
warning('Rule 8 fails: hoorah!');
end
try
r = rdivide(v,m)
error('Rule 8 should fail: booo!');
catch
lasterr
warning('Rule 8 fails: hoorah!');
end
m = [t1 t2 t3; x1 x2 x3];
v = [c1; c2; c3];
try
r = rdivide(m,v)
error('Rule 8 should fail: booo!');
catch
lasterr
warning('Rule 8 fails: hoorah!');
end
try
r = rdivide(v,m)
error('Rule 8 should fail: booo!');
catch
lasterr
warning('Rule 8 fails: hoorah!');
end
%% Rule 9: M_NP .* H_PQ
m = [t1 t2; x1 x2];
h = [c1 c2 c3; c1 c2 c3];
try
r = rdivide(m,h)
error('Rule 9 should fail: booo!');
catch
lasterr
warning('Rule 9 fails: hoorah!');
end
%% Rule 10: matrix .* matrix
m = [t1 t2 t3; x1 x2 x3];
h = [c1 c2 c3; c1 c2 c3];
r = rdivide(m,h)
%% Rule 11: more than two inputs
m = [t1 t2 t3; x1 x2 x3];
v = [c1; c2];
r = rdivide(m,v, c3, v, m)
%% Check units
% empty .* m = m
t1.setYunits('m');
t2.setYunits('');
r = rdivide(t1,t2)
% V .* m = mV
t2.setYunits('V');
r = rdivide(t1,t2)