Location: cellLib @ 7a0891202d18 / BG_fit / writeBGparas.m

Author:
WeiweiAi <wai484@aucklanduni.ac.nz>
Date:
2022-08-17 11:26:32+12:00
Desc:
Add readMatrices and writeBGparas; modify whichComp to be string array; update readme
Permanent Source URI:
https://models.cellml.org/workspace/6bc/rawfile/7a0891202d18fe6d01956b6768e3f10c3dc802c6/BG_fit/writeBGparas.m

%% Write to CellML
function writeBGparas(kappa_name,kappa,Kname,K,q,appendix,fileName)
%kappa_name,kappa,Kname,K,q input:column vectors of string, number
kappa_unit=strcat('fmol_per_sec',cell(length(kappa_name),1));
data_kappa=[strcat('kappa_',kappa_name,appendix),kappa_unit,num2cell(kappa)]';
K_unit=strcat('per_fmol',cell(length(Kname),1));
data_K=[strcat('K_',Kname,appendix),K_unit,num2cell(K)]';
q_unit=strcat('fmol',cell(length(Kname),1));
data_q=[strcat('q_',Kname,'_init',appendix),q_unit,num2cell(q)]';
blanks=strcat('',cell(1,(length(kappa_unit)+length(K_unit)+length(q_unit))));
data_all=[blanks;data_q,data_K,data_kappa];
fileID = fopen(fileName,'w');
fprintf(fileID,'%7s var %s: %s {init: %g};\n',data_all);
fclose(fileID);
end