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

조회 수: 8 (최근 30일)
Hannah
Hannah 2023년 3월 17일
댓글: Hannah 2023년 3월 20일
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
Paul
Paul 2023년 3월 19일
In Figure 1, the input [6 9] is in a Constant block. In Figure 2, is input_grafiek in a Constant block?
Hannah
Hannah 2023년 3월 20일
No, it is a From Workspace block.

댓글을 달려면 로그인하십시오.

채택된 답변

Paul
Paul 2023년 3월 20일
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
Hannah
Hannah 2023년 3월 20일
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!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Clocks and Timers에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by