Problem with number of inputs and outputs
조회 수: 5 (최근 30일)
이전 댓글 표시
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 !
댓글 수: 0
채택된 답변
Sara Nadeau
2023년 7월 6일
What is the type and format of your input data? What type of output do you expect from the From Workspace block?
The From Workspace block supports several formats of input data. In general, creating a timeseries object works for most workflows and provides consistency with the format for most logged data as well.
Here is the reference page for the From Workspace block: https://www.mathworks.com/help/simulink/slref/fromworkspace.html
And here is an example that shows code examples for getting numeric vectors into each supported format: https://www.mathworks.com/help/simulink/ug/load-data-using-the-from-workspace-block.html
I hope these doc links are helpful. If you have more questions or could provide more information about exactly how you configured the block and formatted the data in a way that resulted in this form of output, I might be able to give a more specific answer.
추가 답변 (1개)
Aniketh
2023년 7월 5일
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.
참고 항목
카테고리
Help Center 및 File Exchange에서 Variable Initialization에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!