Simulink only reading first row of matrix from workspace

39 Views Asked by At

I'm using matlab R2019b and I have simulation that produces pressure and temperature, I also have matrix in workspace that has specific heat (cp) values for different pressures and temperatures. I'm trying to access the matrix from simulink with from workspace-block, but I'm only getting the first row, what can I do? I cannot use time vectors because of simulation dynamics.

I have defined the matrix as

p_array = 1e5:1e4:2.5e7;        % rows 
T_array = 300:1:2000;           % columns

cp calculation

and in simulink I have matlab function with syntax

function cp = c(p, T, cp_mat)

T_int = round(T-300+1);
p_int = round((p-1e5)*1e-4+1);
cp = cp_mat(p_int,T_int);
0

There are 0 best solutions below