Borrar filtros
Borrar filtros

Illegal use of cell array indexing in 'equations' block

4 visualizaciones (últimos 30 días)
Rocío Bonilla Villares
Rocío Bonilla Villares el 16 de Oct. de 2020
Respondida: Chidvi Modala el 28 de Oct. de 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

Respuestas (1)

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

Categorías

Más información sobre Upgrading Hydraulic Models to Use Isothermal Liquid Blocks en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by