フィルターのクリア

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

6 ビュー (過去 30 日間)
Marcelo Boldt
Marcelo Boldt 2020 年 10 月 3 日
コメント済み: Marcelo Boldt 2020 年 10 月 6 日
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.
Marcelo Boldt
Marcelo Boldt 2020 年 10 月 3 日
Now I can see the difference, thank you again

サインインしてコメントする。

回答 (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 Center および File ExchangeData Type Conversion についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by