필터 지우기
필터 지우기

How to drive model in simbiology from values on data file?

조회 수: 1 (최근 30일)
Camila Almeida
Camila Almeida 2015년 7월 23일
댓글: Ingrid Tigges 2015년 7월 27일
Hi,
I wanted to simulate a PD model but with a static PK given by a data file that I input into the model. Is that possible? I just have no clue of how to do it.
  댓글 수: 1
Ingrid Tigges
Ingrid Tigges 2015년 7월 23일
What do you mean with static pharmacokinetics? Can you elaborate a bit more how your model looks like?

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

채택된 답변

Ingrid Tigges
Ingrid Tigges 2015년 7월 24일
Do you want a kind of lookup table for your data? If yes you can do it as follows:
1) Create a repeated rule that calls an external function which loads your data file at t=0
2) Store the data in a persistent variable
The external function could look like as follows
function y = AssignmentRule_function(time)
persistent data
%%Variables to customize the behavior
numStates = 4; % The number of states that are saved in the MAT file
stateIndex = 3; % The index of the state you will interpolate
matFileName = 'unnamed.mat'; % Name of the MAT file
%%Ensure data is compatible with code generation
if isempty(data)
data = struct('t', [0;10], 'x', zeros(2,numStates));
end
% Time dimension varies; num states is fixed
coder.varsize('data(:).t');
coder.varsize('data(:).x', [], [true false]);
%%Initialize the data when time == 0
if time == 0
data = load(matFileName, 't', 'x');
end
%%Interpolate the data
y = interp1(data.t, data.x(:,stateIndex), time, 'pchip');
end
  댓글 수: 2
Camila Almeida
Camila Almeida 2015년 7월 27일
Hi, yes I would like for the model to look at the table in order to simulate the PD. Is there any chance we can do this using the nice user interface? I have tried creating a dose (right clicking on column from data file), but that doesn't seem to work... thought of using a variant and declaring the variable I want to read from the table as a parameter, but it doesn't seem you can pull the data from table using that. I also thought of using a covariate but couldn't find any help in doing that, it doesn't seem very straightforward.
Thanks
Ingrid Tigges
Ingrid Tigges 2015년 7월 27일
Hi Camila,
Based on the information you provided, you will have to write your own function looking like the one in my answer. This bit cannot be done in the SimBiology Desktop itself.
If you would like to see this kind of functionality to be part of the SimBiology Desktop, please contact technical support. The amount of customers requesting a certain feature has an impact on the prioritization of work of MathWorks development.
Ingrid

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Import Data에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by