[Simulink] choosing wich blocks to run based on variable
4 views (last 30 days)
Show older comments
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
- Is the g.Usbmap block, represented by the out block;
- Will be my machine learning model, represented by the stop block;
- 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![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1619473/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1619473/image.png)
0 Comments
Answers (1)
cr
on 17 Feb 2024
Edited: cr
on 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.
0 Comments
See Also
Categories
Find more on Classical Control Design in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!