フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Reading Data from Excel Sheets in an Embedded Matlab function

1 回表示 (過去 30 日間)
Vincent Perner
Vincent Perner 2017 年 11 月 24 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
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!!

回答 (0 件)

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by