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

1 次查看(过去 30 天)
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?
  4 个评论
madhan ravi
madhan ravi 2020-10-3
Nope, let me do it this time. You select the entire text first and then press the code button.

请先登录,再进行评论。

回答(1 个)

Ayush Gupta
Ayush Gupta 2020-10-6
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

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by