How to extract data from a file, and form a column vector?
7 ビュー (過去 30 日間)
古いコメントを表示
Take the four files, and run "test.m" in MATLAB. It generates the relative concentrations of Substrate and product as label "SP".
The first experiment gives:
SUBSTRATE (SP first value): 0.98
PRODUCT (SP second value): 2.11
The second generated from test.m gives:
SUBSTRATE: 0.52
PRODUCT: 1.57
The third:
e)
SUBSTRATE: 0.24
PRODUCT: 0.85
and the fourth gives:
SUBSTRATE: 2.38
PRODUCT: 2.71
These are given in the output,
How can I subsbtract these values from the respective y0 values in the test.m output automatically and arrange the difference such as:
r= [ y_0 (first value, first experiment) - SP (first value first experiment,
y_0 (first value, second experiment)- SP (first value second experiment,
y_0 (first value, third experiment)- SP (first value third experiment ,
y_0 (first value, fourth experiment)- SP (first value fourth experiment,
y_0 (second value, first experiment)- SP (second value first experiment ,
y_0 (second value, second experiment)- SP (second value second experiment,
y_0 (second value, third experiment)- SP (second value third experiment ,
y_0 (second value, fourth experiment)- SP (second value fourth experiment ]
These entries are respectively by the output of test:
2-0.98,
1-0.52,
1-0.24,
4-2.38,
1-2.11,
1-1.57,
0-0.85,
1-2.71
These would hence form a vector r=[1.02, 0.48, 0.76, 1.72, ...., -1.71]
Thanks!
0 件のコメント
採用された回答
その他の回答 (1 件)
Stephen23
2024 年 3 月 18 日
編集済み: Stephen23
2024 年 3 月 18 日
Note that copy-and-pasting blocks of code like that... is not a generalized approach to writing code. Best avoided.
Rather than doing the computer's job by painstakingly copy-and-paste-and-modifying code like that, let the computer do that simple task by writing a loop. For example:
ym = [2,1;1,1;1,0;4,1];
dt = 0.01;
T = 1;
k = [5;1];
SP = nan(size(ym));
for ii = 1:size(ym,1)
y0 = ym(ii,:);
[SP(ii,:),~] = enzyme(y0,k,dt,T);
end
V = ym(:)-SP(:)
Note that EXPERIMENT1 is unused.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Structures についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!