Hello all,
I have defined time variable which I am reading from excel and would like to send ECU my signals (X and Y) according to time vector.
For Example :
when time <1 s
X=10%
Y=1
when time <2
X=11%
Y=1
and so ...
Normally my time vector is 90 sec however when I run my script it takes too long. Do you have any idea where I am making mistake? Could you advice me better solution ?
Best Regards
for i=2:100
tic
while toc<Time(i)
% time=Time(i);
X_inca=X(i);
Y_inca=Y_C(i);
end
end

댓글 수: 1

Image Analyst
Image Analyst 2023년 1월 9일
편집: Image Analyst 2023년 1월 9일
What does this mean "Time vector is 90 sec"? All we know is it has 100 elements, and we don't even know what the units are.
The loop will go as fast as it can. The loop as you have it there will probably get done within a few nanoseconds or microseconds. Not sure if you were thinking that loop would take around 90 seconds or more, but it won't unless you have a lot more time consuming stuff in there that you have not shown.
If you have any more questions, then attach your data and code to read it in with the paperclip icon after you read this:
save('camsi answers.mat', 'Time', 'X', 'Y_C');

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

제품

릴리스

R2022a

태그

질문:

2023년 1월 9일

편집:

2023년 1월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by