Effacer les filtres
Effacer les filtres

Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

Reading Data from Excel Sheets in an Embedded Matlab function

1 vue (au cours des 30 derniers jours)
Vincent Perner
Vincent Perner le 24 Nov 2017
Clôturé : MATLAB Answer Bot le 20 Août 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!!

Réponses (0)

Cette question est clôturée.

Community Treasure Hunt

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

Start Hunting!

Translated by