Illegal use of cell array indexing in 'equations' block

3 views (last 30 days)
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

Answers (1)

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

Categories

Find more on Upgrading Hydraulic Models to Use Isothermal Liquid Blocks 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!