Undefined function 'mtimes' for input arguments of type 'cell'.

2 views (last 30 days)
I am having some trouble with obtaining a calculation. I first used:
radians=0;
Rs=1.00021697;
dRs=250;
SeattleG=32.17546;
GNOG=32.12536;
VSFR=cos(radians)*((ATretreive{1,3} - (ATretreive{1,5}))/(2*Rs)); %Vertical readings-scale factor
VBR=((ATretreive{1,3} + ATretreive{1,5})/(2*VSFR))*1000000; %Vertical readings-bias
VRTemp=(((ATretreive{1,7} + (ATretreive{1,8}) + (ATretreive{1,9}) + (ATretreive{1,10}))/4) *100)-273; %Vertical readings-temp
HBR=((ATretreive{1,4} + ATretreive{1,6})/(2*VSFR))*1000000; %Horizontal readings-bias
rmdData=importdata('AccelQuery.mat')
SERIAL_NUMBER={rmdData.('SERIAL_NUMBER')}
BIA_COF_0={rmdData.('BIA_COF_0')}
BIA_COF_1={rmdData.('BIA_COF_1')}
BIA_COF_2={rmdData.('BIA_COF_2')}
BIA_COF_3={rmdData.('BIA_COF_3')}
BIA_COF_4={rmdData.('BIA_COF_4')}
SF_COF_0={rmdData.('SF_COF_0')}
SF_COF_1={rmdData.('SF_COF_1')}
SF_COF_2={rmdData.('SF_COF_2')}
SF_COF_3={rmdData.('SF_COF_3')}
SF_COF_4={rmdData.('SF_COF_4')}
mergetables=table(SERIAL_NUMBER,BIA_COF_0,BIA_COF_1,BIA_COF_2,BIA_COF_3...
,BIA_COF_4,SF_COF_0,SF_COF_1,SF_COF_2,SF_COF_3,SF_COF_4);
uitdata=uitable(uifigure,'Data',mergetables);
uitdata.ColumnName={'Accel S/N' ;'BIA_COF_0'; 'BIA_COF_1'; 'BIA_COF_2'; 'BIA_COF_3' ;'BIA_COF_4';...
'SF_COF_0'; 'SF_COF_1'; 'SF_COF_2' ;'SF_COF_3' ;'SF_COF_4'};
BIA0=mergetables{app.AccelSNEditField == mergetables{:,1},2};
BIA1=mergetables{app.AccelSNEditField == mergetables{:,1},3};
BIA2=mergetables{app.AccelSNEditField == mergetables{:,1},4};
BIA3=mergetables{app.AccelSNEditField == mergetables{:,1},5};
BIA4=mergetables{app.AccelSNEditField == mergetables{:,1},6};
SF0=mergetables{app.AccelSNEditField == mergetables{:,1},7};
SF1=mergetables{app.AccelSNEditField == mergetables{:,1},8};
SF2=mergetables{app.AccelSNEditField == mergetables{:,1},9};
SF3=mergetables{app.AccelSNEditField == mergetables{:,1},10};
SF4=mergetables{app.AccelSNEditField == mergetables{:,1},11};
CalcBias=(BIA0+(BIA1*(VRTemp-20))+(BIA2*(VRTemp-20)^2)+(BIA3*(VRTemp-20)^3)+...
(BIA4*(VRTemp-20)^4))*(SeattleG/GNOG); %Calculated Bias
Then I get an error for CalcBias:
Undefined function 'mtimes' for input arguments of type 'cell'.
Any suggestions or resolutions?

Answers (1)

Steven Lord
Steven Lord on 14 Jul 2020
Matrix multiplication isn't defined for a cell array. No arithmetic operators are. Unlike a double or single precision matrix, the elements in a cell array don't have to contain just numbers. They don't have to be scalars.
C = {'abcde', ones(2, 3, 4), magic(5); {'q'}, struct('abc', 'def'), []}
You can't multiply C by anything or anything by C.
A = C*[1 2; 3 4] % Throws an error
You can't multiply C(1, 3) by anything or anything by C(1, 3). C(1, 3) is itself a cell.
B = C(1, 3)*fliplr(eye(5)) % Throws an error
You can multiply C{1, 3} (which is a 5-by-5 matrix) by something with which it's compatible.
D = C{1,3}*fliplr(eye(5))
  4 Comments

Sign in to comment.

Categories

Find more on Structures in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!