Borrar filtros
Borrar filtros

Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Reading Data from Excel Sheets in an Embedded Matlab function

1 visualización (últimos 30 días)
Vincent Perner
Vincent Perner el 24 de Nov. de 2017
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
Hey Guys,
i am trying to read data from Excel sheets from within a matlab function in Simulink. M So far my code is:
function Leistung_Maschine_1 = function1(s_off,s_de,s_sb,s_op,s_w,time,data)
coder.extrinsic('assignin')
if s_off==1
Leistung_Maschine_1=0;
elseif s_de == 1
Leistung_Maschine_1=data(4);
elseif s_sb == 1
Leistung_Maschine_1=data(3);
elseif s_op == 1
Leistung_Maschine_1=data(2);
elseif s_w == 1
Leistung_Maschine_1=data(1);
else
disp('warning');
Leistung_Maschine_1=NaN;
assignin('base','Leistung_Maschine_1',Leistung_Maschine_1);
end
The problem is that, for example, when input s_op goes from 0 to 1 at simulation time 200, the 200th row of data(2) is given out as output but it should take the first value in row 1 and then starts to read out the values row after row. Also, at any given reentering of a statement at any simulation time, the output should start at the first row.
Does anyone know how i can fix my code?
Thank you very much!!

Respuestas (0)

La pregunta está cerrada.

Community Treasure Hunt

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

Start Hunting!

Translated by