How to extract data from a file, and form a column vector?
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuesta aceptada
Voss
el 18 de Mzo. de 2024
See the attached test_modified for one way to do that.
test_modified
2 comentarios
Más respuestas (1)
Stephen23
el 18 de Mzo. de 2024
Editada: Stephen23
el 18 de Mzo. de 2024
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 comentarios
Ver también
Categorías
Más información sobre Structures en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!