How to use a from workspace function for a 1D lookup table

9 views (last 30 days)
Hello everyone,
I want to have 2 inputs and 2 ouputs for a 1D lookup table so that afterward I can subtract the two outputs from each other. I found online that you can do this by using a vector. When I do it with a vector, it works (figure 1) but when I want to use a vector that I made in the matlab workspace from 2 variables, it gives an error (figure 2). I really need to use the from workspace fuction because in a further proces, the variables from the input wil come from previous calculations and can't be inserted manually each time. Does anyone of you know how to fix this problem and properly use the from workspace function?
Thanks in advance!!
Figure 1
Figure 2
  2 Comments
Paul
Paul on 19 Mar 2023
In Figure 1, the input [6 9] is in a Constant block. In Figure 2, is input_grafiek in a Constant block?

Sign in to comment.

Accepted Answer

Paul
Paul on 20 Mar 2023
Dose input_grafiek have a constant value over the entire simulation run? If it does, don't use a From Workspace block. Instead, use a Constant block and enter 'input_grafiek' (without the single quote marks) in the field 'Constant value'. Then, when you run the simulation it will use whatever the value is for input_grafiek as defined in the Matlab base workspace.
If input_gafiek is a 2D array representing a function of time, then you can use a From Workspace block with an array input, but the first column in the array has to be a time vector. More discussion starting at this doc page.
  1 Comment
Hannah
Hannah on 20 Mar 2023
input_grafiek does have a constant value over the entire simulation run. I replaced it with a constant block and it works, thank you very much!

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!