Filter löschen
Filter löschen

Illegal use of cell array indexing in 'equations' block

4 Ansichten (letzte 30 Tage)
Rocío Bonilla Villares
Rocío Bonilla Villares am 16 Okt. 2020
Beantwortet: Chidvi Modala am 28 Okt. 2020
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

Antworten (1)

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

Kategorien

Mehr zu Upgrading Hydraulic Models to Use Isothermal Liquid Blocks finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by