Problem with number of inputs and outputs
Show older comments
Hi everyone, I have just a little question about inputs and output.
First of all, the thing that I want to do is to put as input of an generic engine a variable that change for every second of the simulation (variable from Matlab workspace).
So I put a "From workspace" block and it has 2395 outputs, so of course it cannot connect to a simulink - PS converter that have only one input port.
That's why I'm asking how can I do this.
Thanks in advance for the reply !
Accepted Answer
More Answers (1)
Aniketh
on 5 Jul 2023
0 votes
To connect multiple outputs from a "From Workspace" block to a single input port of a Simulink block, you can use a "Bus Creator" block. The "Bus Creator" block allows you to combine multiple signals into a bus signal, which can then be connected to a single input port.
Here's how you can connect multiple outputs from the "From Workspace" block to a single input port using a "Bus Creator" block:
- Place a "From Workspace" block in your Simulink model.
- Specify the variable name and the sample time for the "From Workspace" block to retrieve the data.
- Right-click on the "From Workspace" block and select "Outputs > Add Output". Repeat this step for each output you want to have.
- Place a "Bus Creator" block in your Simulink model. You can find it in the "Simulink/Signal Routing" library.
- Open the "Bus Creator" block by double-clicking on it.
- In the "Bus Creator" dialog box, click on the "+" button to add a new bus element for each output from the "From Workspace" block.
- Give each bus element a name and specify its data type and dimensions to match the corresponding output from the "From Workspace" block.
- Connect the outputs of the "From Workspace" block to the corresponding bus elements in the "Bus Creator" block.
- Connect the output of the "Bus Creator" block to the input port of the Simulink block that requires the multiple inputs.
By following these steps, you can combine the multiple outputs from the "From Workspace" block into a bus signal using the "Bus Creator" block. This bus signal can then be connected to a single input port in your Simulink model.
1 Comment
BAPTISTE PLASENZOTTI
on 6 Jul 2023
Edited: BAPTISTE PLASENZOTTI
on 6 Jul 2023
Categories
Find more on Troubleshooting 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!