Illegal use of cell array indexing in 'equations' block

9 次查看(过去 30 天)
Hi,
I'm trying to do a non-ideal flowmeter with simscape component reusing the hydraulic flow rate sensor's source data. For that, I want to put that the differential pressure between the nodes (A and B) must be equal to a calculation done outside and introduced as input (P_loss). However, when I compile the error "Illegal use of cell array indexing in 'equations' block" appears. So, does anybody know how can manage that equality without cell arrays indexing? cell2mat does not work either and putting directly p == P_loss neither despite they have the same cell array's values.
component nonideal_flowmeter
inputs
P_loss = {0, 'Pa'}; % P_loss:left
end
nodes
A = foundation.hydraulic.hydraulic; % A:left
B = foundation.hydraulic.hydraulic; % B:right
end
variables
q = {1e-3, 'm^3/s'}; % Flow rate
p = {0, 'Pa'}; % Pressure differential
end
branches
q : A.q -> B.q;
end
intermediates
int_term1 = P_loss{1,1};
end
equations
p == A.p - B.p;
p == {int_term1, 'Pa'};
end
end

回答(1 个)

Chidvi Modala
Chidvi Modala 2020-10-28
Hi Rocio,
Did you try using the following?
cellfun(@isequal, p, P_loss);

类别

Help CenterFile Exchange 中查找有关 Upgrading Hydraulic Models to Use Isothermal Liquid Blocks 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by