Stateflow with embedded coder array storage in generated code
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Hi all,
I am creating a basic flow chart that I want to run on an STM32 microcontroller with embedded coder. I need to monitor the temperature and use it in the stateflow chart. Therefore I want to have an array where I can store the temperature every sample step but in a form, where the array is always full and the last measurement drops out (similar to a ring buffer). So that the array is always filled with the most recent values. Is there a block I can use directly or do I need to create such a behaviour with e.g. a matlab function or something?
Just as additional information I then want to use the last 100 values to check if the temperature is rising or falling.
I am thankfull for any help
bests lukas
0 Commenti
Risposte (1)
Sara Boznik
il 2 Lug 2023
Hi,
this is my idea:
T=[] %%your data
i=400 %%example if you want to check for values 400-500
for i=400:1:500 %%then just check how many loops where complete, if is less than 100 than is not rising
if T(i+1)>=T(i)
i=i+1
else
end
end
I am quite new here, so I if this doesnt help I am sorry.
Hope it helps.
0 Commenti
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!