[Simulink] choosing wich blocks to run based on variable

3 visualizzazioni (ultimi 30 giorni)
Fernando
Fernando il 16 Feb 2024
Modificato: cr il 17 Feb 2024
Hi everyone, my first question here since I´m starting to work with matlab,
I have a simulink model for EEG data acquisition using gSBamp (attached image) and I´d like to acquire the data firts and then start my machine learning model based on the value of a output variable from a s-function and the data collected in a later stage of the simulation .
In the image attached the those elements are represented by the hexagons
  1. Is the g.Usbmap block, represented by the out block;
  2. Will be my machine learning model, represented by the stop block;
  3. Is the data collected in the first part and that will be loaded in the second part
My questions are:
  • Is there a block that I could use so it would stop the data acquisition and trigger the machine learning part?
  • And how can I load the datafile block to my model, given that there´s no output arrow in the block?
Thanks in advance for the help!
Cheers

Risposte (1)

cr
cr il 17 Feb 2024
Modificato: cr il 17 Feb 2024
You may be able to do it with an if-else block. It's not clear how long the data acquisition will be but some kind of logic or manual switch can be used to transfer control from one subsystem to another. In Simulink. however, we generally don't do it that way. Why not keep the acquistion model separate since you (presumably) need to acquire data once and perhaps experiment training adjusting various settings several times.

Community Treasure Hunt

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

Start Hunting!

Translated by