# Operator '*' is not supported for operands of type 'cell' after changing the cell

4 views (last 30 days)
Marcelo Boldt on 3 Oct 2020
Commented: Marcelo Boldt on 6 Oct 2020
Hello,
So after realizing Runge Kutta I obtain a 49x1 cell that contains 7x7 double variables. Later on I need to remove one row and one column from each variable to obtain a 6x6 double. Finally I need to do operations with those variables but im getting this error Operator '*' is not supported for operands of type 'cell'.
Here my code:
for i=1:(L-1) % calculation loop
k_1 = A{i,:}*B{:,i}; % calculating coefficient
k_2 = (A{i,:} + (A{i+1,:}-A{i,:})/2)*(B{:,i}+0.5*h*k_1);
k_3 = (A{i,:} + (A{i+1,:}-A{i,:})/2)*(B{:,i}+0.5*h*k_2);
k_4 = (A{i+1,:})*(B{:,i}+k_3*h);
B{:,i+1} = B{:,i} + (h/6)*(k_1+2*k_2+2*k_3+k_4); % main equation
Ubertragungsmatrix_cell{i,:} = B{:,i};
Ubertragungsmatrix = cell2mat(Ubertragungsmatrix_cell);
% New_Last_vektor = mat2cell(cell2mat(Ubertragungsmatrix
end
U2 = Ubertragungsmatrix;
Ubertragungsmatrix(7:7:end,:) = [];
Last_vektor = num2cell(Ubertragungsmatrix(:,end));
Ubertragungsmatrix(:,end) = [];
Transfer_matrix = mat2cell(Ubertragungsmatrix,[6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6],[6]);
Pu_tr = cell(1,49);
Pn_tr = cell(1,49);
C = num2cell(reshape(Last_vektor(:, end), 3, []), 1);
% C1 = num2cell(cellfun(@(x) {reshape(x, [], 3)}, C));
% [Pu_tr, Pn_tr] = deal(C1{ : });
for ik = 1:49
Pu_tr{:,ik} = C{:,(ik-1)*2+1};
Pn_tr{:,ik} = C{:,2*ik};
Gesamtsystem_zylinder{ik,:} = Transfer_matrix{ik,:};
end
PV_tr = num2cell(Pu_tr',2);
PN_tr = str2double(Pn_tr');
for ih = 1:2:97
P_Tank_Reinforcement{ih,1} = - pinv(Gesamtsystem_Zylinder_Matrix{ih,2}) * PV_tr{ih,:}; %-> Here I get my error
end
How would you solve this?
madhan ravi on 3 Oct 2020
Nope, let me do it this time. You select the entire text first and then press the code button.
Marcelo Boldt on 3 Oct 2020
Now I can see the difference, thank you again

Ayush Gupta on 6 Oct 2020
The two values we are trying to multiply are cell array and one cannot multiply cell arrays.
You might be able to use
Cell1{i1}*Cell2{i2}
instead, to access the contents of the cell, rather than the cell itself
Marcelo Boldt on 6 Oct 2020
Great idea, how would you propose to do that?