Generated Code
The following is matlab code generated by the CellML API from this CellML file. (Back to language selection)
The raw code is available.
function [VOI, STATES, ALGEBRAIC, CONSTANTS] = mainFunction()
% This is the "main function". In Matlab, things work best if you rename this function to match the filename.
[VOI, STATES, ALGEBRAIC, CONSTANTS] = solveModel();
end
function [algebraicVariableCount] = getAlgebraicVariableCount()
% Used later when setting a global variable with the number of algebraic variables.
% Note: This is not the "main method".
algebraicVariableCount =9;
end
% There are a total of 21 entries in each of the rate and state variable arrays.
% There are a total of 38 entries in the constant variable array.
%
function [VOI, STATES, ALGEBRAIC, CONSTANTS] = solveModel()
% Create ALGEBRAIC of correct size
global algebraicVariableCount; algebraicVariableCount = getAlgebraicVariableCount();
% Initialise constants and state variables
[INIT_STATES, CONSTANTS] = initConsts;
% Set timespan to solve over
tspan = [0, 10];
% Set numerical accuracy options for ODE solver
options = odeset('RelTol', 1e-06, 'AbsTol', 1e-06, 'MaxStep', 1);
% Solve model with ODE solver
[VOI, STATES] = ode15s(@(VOI, STATES)computeRates(VOI, STATES, CONSTANTS), tspan, INIT_STATES, options);
% Compute algebraic variables
[RATES, ALGEBRAIC] = computeRates(VOI, STATES, CONSTANTS);
ALGEBRAIC = computeAlgebraic(ALGEBRAIC, CONSTANTS, STATES, VOI);
% Plot state variables against variable of integration
[LEGEND_STATES, LEGEND_ALGEBRAIC, LEGEND_VOI, LEGEND_CONSTANTS] = createLegends();
figure();
plot(VOI, STATES);
xlabel(LEGEND_VOI);
l = legend(LEGEND_STATES);
set(l,'Interpreter','none');
end
function [LEGEND_STATES, LEGEND_ALGEBRAIC, LEGEND_VOI, LEGEND_CONSTANTS] = createLegends()
LEGEND_STATES = ''; LEGEND_ALGEBRAIC = ''; LEGEND_VOI = ''; LEGEND_CONSTANTS = '';
LEGEND_VOI = strpad('time in component environment (minute)');
LEGEND_ALGEBRAIC(:,1) = strpad('x1 in component x1 (molar)');
LEGEND_STATES(:,1) = strpad('x2 in component x2 (molar)');
LEGEND_CONSTANTS(:,1) = strpad('k1 in component reaction_constants (second_order_rate_constant)');
LEGEND_CONSTANTS(:,2) = strpad('k_minus1 in component reaction_constants (first_order_rate_constant)');
LEGEND_CONSTANTS(:,23) = strpad('k4 in component reaction_constants (first_order_rate_constant)');
LEGEND_CONSTANTS(:,3) = strpad('k_minus4 in component reaction_constants (first_order_rate_constant)');
LEGEND_CONSTANTS(:,24) = strpad('k_minus3 in component reaction_constants (second_order_rate_constant)');
LEGEND_STATES(:,2) = strpad('x3 in component x3 (molar)');
LEGEND_STATES(:,3) = strpad('x5 in component x5 (molar)');
LEGEND_STATES(:,4) = strpad('x6 in component x6 (molar)');
LEGEND_ALGEBRAIC(:,6) = strpad('PTP in component reaction_constants (molar)');
LEGEND_CONSTANTS(:,4) = strpad('k3 in component reaction_constants (first_order_rate_constant)');
LEGEND_STATES(:,5) = strpad('x4 in component x4 (molar)');
LEGEND_CONSTANTS(:,25) = strpad('k2 in component reaction_constants (second_order_rate_constant)');
LEGEND_CONSTANTS(:,26) = strpad('k_minus2 in component reaction_constants (first_order_rate_constant)');
LEGEND_CONSTANTS(:,5) = strpad('k4b in component reaction_constants (first_order_rate_constant)');
LEGEND_CONSTANTS(:,6) = strpad('k_minus4b in component reaction_constants (first_order_rate_constant)');
LEGEND_STATES(:,6) = strpad('x7 in component x7 (molar)');
LEGEND_STATES(:,7) = strpad('x8 in component x8 (molar)');
LEGEND_ALGEBRAIC(:,8) = strpad('k5 in component reaction_constants (rate)');
LEGEND_CONSTANTS(:,7) = strpad('k_minus5 in component reaction_constants (first_order_rate_constant)');
LEGEND_CONSTANTS(:,8) = strpad('k6 in component reaction_constants (second_order_rate_constant)');
LEGEND_STATES(:,8) = strpad('x9 in component x9 (molar)');
LEGEND_CONSTANTS(:,9) = strpad('k7 in component reaction_constants (first_order_rate_constant)');
LEGEND_CONSTANTS(:,27) = strpad('k_minus7 in component reaction_constants (second_order_rate_constant)');
LEGEND_CONSTANTS(:,28) = strpad('k7b in component reaction_constants (first_order_rate_constant)');
LEGEND_CONSTANTS(:,36) = strpad('k_minus7b in component reaction_constants (first_order_rate_constant)');
LEGEND_STATES(:,9) = strpad('x10 in component x10 (molar)');
LEGEND_STATES(:,10) = strpad('x10a in component x10a (molar)');
LEGEND_CONSTANTS(:,10) = strpad('IRp in component reaction_constants (molar)');
LEGEND_ALGEBRAIC(:,9) = strpad('PKC in component reaction_constants (dimensionless)');
LEGEND_CONSTANTS(:,29) = strpad('k8 in component reaction_constants (second_order_rate_constant)');
LEGEND_CONSTANTS(:,11) = strpad('k_minus8 in component reaction_constants (first_order_rate_constant)');
LEGEND_STATES(:,11) = strpad('x11 in component x11 (molar)');
LEGEND_STATES(:,12) = strpad('x12 in component x12 (molar)');
LEGEND_STATES(:,13) = strpad('x13 in component x13 (percentage)');
LEGEND_ALGEBRAIC(:,2) = strpad('k9 in component reaction_constants (first_order_rate_constant)');
LEGEND_CONSTANTS(:,30) = strpad('k_minus9 in component reaction_constants (second_order_rate_constant)');
LEGEND_CONSTANTS(:,31) = strpad('k10 in component reaction_constants (first_order_rate_constant)');
LEGEND_CONSTANTS(:,12) = strpad('k_minus10 in component reaction_constants (second_order_rate_constant)');
LEGEND_STATES(:,14) = strpad('x14 in component x14 (percentage)');
LEGEND_STATES(:,15) = strpad('x15 in component x15 (percentage)');
LEGEND_CONSTANTS(:,13) = strpad('PTEN in component reaction_constants (molar)');
LEGEND_CONSTANTS(:,14) = strpad('SHIP in component reaction_constants (molar)');
LEGEND_STATES(:,16) = strpad('x16 in component x16 (percentage)');
LEGEND_ALGEBRAIC(:,3) = strpad('k11 in component reaction_constants (first_order_rate_constant)');
LEGEND_CONSTANTS(:,32) = strpad('k_minus11 in component reaction_constants (first_order_rate_constant)');
LEGEND_STATES(:,17) = strpad('x17 in component x17 (percentage)');
LEGEND_STATES(:,18) = strpad('x18 in component x18 (percentage)');
LEGEND_ALGEBRAIC(:,4) = strpad('k12 in component reaction_constants (first_order_rate_constant)');
LEGEND_CONSTANTS(:,33) = strpad('k_minus12 in component reaction_constants (first_order_rate_constant)');
LEGEND_STATES(:,19) = strpad('x19 in component x19 (percentage)');
LEGEND_STATES(:,20) = strpad('x20 in component x20 (percentage)');
LEGEND_CONSTANTS(:,34) = strpad('k13 in component reaction_constants (first_order_rate_constant)');
LEGEND_CONSTANTS(:,15) = strpad('k_minus13 in component reaction_constants (first_order_rate_constant)');
LEGEND_ALGEBRAIC(:,7) = strpad('k13b in component reaction_constants (first_order_rate_constant)');
LEGEND_CONSTANTS(:,35) = strpad('k14 in component reaction_constants (first_order_rate_constant)');
LEGEND_CONSTANTS(:,16) = strpad('k_minus14 in component reaction_constants (first_order_rate_constant)');
LEGEND_STATES(:,21) = strpad('x21 in component x21 (percentage)');
LEGEND_CONSTANTS(:,17) = strpad('V_max in component reaction_constants (dimensionless)');
LEGEND_CONSTANTS(:,18) = strpad('K_d in component reaction_constants (dimensionless)');
LEGEND_CONSTANTS(:,19) = strpad('n in component reaction_constants (dimensionless)');
LEGEND_CONSTANTS(:,20) = strpad('tau in component reaction_constants (minute)');
LEGEND_CONSTANTS(:,37) = strpad('k9_basal in component reaction_constants (first_order_rate_constant)');
LEGEND_CONSTANTS(:,21) = strpad('k9_stimulated in component reaction_constants (first_order_rate_constant)');
LEGEND_ALGEBRAIC(:,5) = strpad('effect in component reaction_constants (dimensionless)');
LEGEND_CONSTANTS(:,22) = strpad('APequil in component reaction_constants (dimensionless)');
LEGEND_CONSTANTS(:,38) = strpad('PI3K in component reaction_constants (molar)');
LEGEND_RATES(:,1) = strpad('d/dt x2 in component x2 (molar)');
LEGEND_RATES(:,2) = strpad('d/dt x3 in component x3 (molar)');
LEGEND_RATES(:,5) = strpad('d/dt x4 in component x4 (molar)');
LEGEND_RATES(:,3) = strpad('d/dt x5 in component x5 (molar)');
LEGEND_RATES(:,4) = strpad('d/dt x6 in component x6 (molar)');
LEGEND_RATES(:,6) = strpad('d/dt x7 in component x7 (molar)');
LEGEND_RATES(:,7) = strpad('d/dt x8 in component x8 (molar)');
LEGEND_RATES(:,8) = strpad('d/dt x9 in component x9 (molar)');
LEGEND_RATES(:,9) = strpad('d/dt x10 in component x10 (molar)');
LEGEND_RATES(:,10) = strpad('d/dt x10a in component x10a (molar)');
LEGEND_RATES(:,11) = strpad('d/dt x11 in component x11 (molar)');
LEGEND_RATES(:,12) = strpad('d/dt x12 in component x12 (molar)');
LEGEND_RATES(:,13) = strpad('d/dt x13 in component x13 (percentage)');
LEGEND_RATES(:,14) = strpad('d/dt x14 in component x14 (percentage)');
LEGEND_RATES(:,15) = strpad('d/dt x15 in component x15 (percentage)');
LEGEND_RATES(:,16) = strpad('d/dt x16 in component x16 (percentage)');
LEGEND_RATES(:,17) = strpad('d/dt x17 in component x17 (percentage)');
LEGEND_RATES(:,18) = strpad('d/dt x18 in component x18 (percentage)');
LEGEND_RATES(:,19) = strpad('d/dt x19 in component x19 (percentage)');
LEGEND_RATES(:,20) = strpad('d/dt x20 in component x20 (percentage)');
LEGEND_RATES(:,21) = strpad('d/dt x21 in component x21 (percentage)');
LEGEND_STATES = LEGEND_STATES';
LEGEND_ALGEBRAIC = LEGEND_ALGEBRAIC';
LEGEND_RATES = LEGEND_RATES';
LEGEND_CONSTANTS = LEGEND_CONSTANTS';
end
function [STATES, CONSTANTS] = initConsts()
VOI = 0; CONSTANTS = []; STATES = []; ALGEBRAIC = [];
STATES(:,1) = 9e-13;
CONSTANTS(:,1) = 6e7;
CONSTANTS(:,2) = 0.2;
CONSTANTS(:,3) = 0.003;
STATES(:,2) = 0;
STATES(:,3) = 0;
STATES(:,4) = 1e-13;
CONSTANTS(:,4) = 2500;
STATES(:,5) = 0;
CONSTANTS(:,5) = 2.1e-3;
CONSTANTS(:,6) = 2.1e-4;
STATES(:,6) = 0;
STATES(:,7) = 0;
CONSTANTS(:,7) = 1.67e-18;
CONSTANTS(:,8) = 0.461;
STATES(:,8) = 1e-12;
CONSTANTS(:,9) = 4.16;
STATES(:,9) = 0;
STATES(:,10) = 0;
CONSTANTS(:,10) = 8.97e-13;
CONSTANTS(:,11) = 10;
STATES(:,11) = 1e-13;
STATES(:,12) = 2.54e-15;
STATES(:,13) = 0.31;
CONSTANTS(:,12) = 2.77;
STATES(:,14) = 99.4;
STATES(:,15) = 0.29;
CONSTANTS(:,13) = 1;
CONSTANTS(:,14) = 1;
STATES(:,16) = 100;
STATES(:,17) = 0;
STATES(:,18) = 100;
STATES(:,19) = 0;
STATES(:,20) = 96;
CONSTANTS(:,15) = 0.167;
CONSTANTS(:,16) = 0.001155;
STATES(:,21) = 4;
CONSTANTS(:,17) = 20;
CONSTANTS(:,18) = 12;
CONSTANTS(:,19) = 4;
CONSTANTS(:,20) = 1.5;
CONSTANTS(:,21) = 1.39;
CONSTANTS(:,22) = 9.09;
CONSTANTS(:,23) = CONSTANTS(:,3)./9.00000;
CONSTANTS(:,24) = CONSTANTS(:,2)./1.00000;
CONSTANTS(:,25) = CONSTANTS(:,1);
CONSTANTS(:,26) = 100.000.*CONSTANTS(:,2);
CONSTANTS(:,27) = (2.50000./7.45000).*CONSTANTS(:,9);
CONSTANTS(:,28) = log(2.00000)./2.00000;
CONSTANTS(:,29) = (( CONSTANTS(:,11).*5.00000)./70.7750).*1.00000e+12;
CONSTANTS(:,30) = (94.0000./3.10000).*CONSTANTS(:,21);
CONSTANTS(:,31) = (3.10000./2.90000).*CONSTANTS(:,12);
CONSTANTS(:,32) = 10.0000.*log(2.00000).*1.00000;
CONSTANTS(:,33) = 10.0000.*log(2.00000).*1.00000;
CONSTANTS(:,34) = (4.00000./96.0000).*CONSTANTS(:,15);
CONSTANTS(:,35) = CONSTANTS(:,16)./96.0000;
CONSTANTS(:,36) = ( (( CONSTANTS(:,28).*2.50000)./7.45000).*3.70000e-13)./(6.27000e-13 - (2.50000./7.45000).*3.70000e-13);
CONSTANTS(:,37) = (0.310000./99.4000).*CONSTANTS(:,30);
CONSTANTS(:,38) = ( CONSTANTS(:,29).*3.70000e-13.*1.00000e-13)./( CONSTANTS(:,29).*3.70000e-13+CONSTANTS(:,11));
if (isempty(STATES)), warning('Initial values for states not set');, end
end
function [RATES, ALGEBRAIC] = computeRates(VOI, STATES, CONSTANTS)
global algebraicVariableCount;
statesSize = size(STATES);
statesColumnCount = statesSize(2);
if ( statesColumnCount == 1)
STATES = STATES';
ALGEBRAIC = zeros(1, algebraicVariableCount);
utilOnes = 1;
else
statesRowCount = statesSize(1);
ALGEBRAIC = zeros(statesRowCount, algebraicVariableCount);
RATES = zeros(statesRowCount, statesColumnCount);
utilOnes = ones(statesRowCount, 1);
end
RATES(:,11) = CONSTANTS(:,11).*STATES(:,12) - CONSTANTS(:,29).*STATES(:,9).*STATES(:,11);
RATES(:,12) = CONSTANTS(:,29).*STATES(:,9).*STATES(:,11) - CONSTANTS(:,11).*STATES(:,12);
RATES(:,15) = CONSTANTS(:,12).*CONSTANTS(:,14).*STATES(:,13) - CONSTANTS(:,31).*STATES(:,15);
ALGEBRAIC(:,1) = piecewise({VOI<15.0000, 1.00000e-07 }, 0.00000);
RATES(:,2) = CONSTANTS(:,1).*ALGEBRAIC(:,1).*STATES(:,1) - ( CONSTANTS(:,2).*STATES(:,2)+ CONSTANTS(:,4).*STATES(:,2));
RATES(:,5) = ( CONSTANTS(:,25).*ALGEBRAIC(:,1).*STATES(:,3)+ CONSTANTS(:,6).*STATES(:,6)) - ( CONSTANTS(:,26).*STATES(:,5)+ CONSTANTS(:,5).*STATES(:,5));
ALGEBRAIC(:,2) = ( (CONSTANTS(:,21) - CONSTANTS(:,37)).*STATES(:,12))./CONSTANTS(:,38)+CONSTANTS(:,37);
RATES(:,13) = ( ALGEBRAIC(:,2).*STATES(:,14)+ CONSTANTS(:,31).*STATES(:,15)) - ( CONSTANTS(:,30).*CONSTANTS(:,13)+ CONSTANTS(:,12).*CONSTANTS(:,14)).*STATES(:,13);
RATES(:,14) = CONSTANTS(:,30).*CONSTANTS(:,13).*STATES(:,13) - ALGEBRAIC(:,2).*STATES(:,14);
ALGEBRAIC(:,3) = ( 0.100000.*CONSTANTS(:,32).*(STATES(:,13) - 0.310000))./(3.10000 - 0.310000);
RATES(:,16) = CONSTANTS(:,32).*STATES(:,17) - ALGEBRAIC(:,3).*STATES(:,16);
RATES(:,17) = ALGEBRAIC(:,3).*STATES(:,16) - CONSTANTS(:,32).*STATES(:,17);
ALGEBRAIC(:,4) = ( 0.100000.*CONSTANTS(:,33).*(STATES(:,13) - 0.310000))./(3.10000 - 0.310000);
RATES(:,18) = CONSTANTS(:,33).*STATES(:,19) - ALGEBRAIC(:,4).*STATES(:,18);
RATES(:,19) = ALGEBRAIC(:,4).*STATES(:,18) - CONSTANTS(:,33).*STATES(:,19);
ALGEBRAIC(:,6) = piecewise({STATES(:,17)<=400.000./11.0000||ALGEBRAIC(:,1)>=1.00000e-07, 1.00000 - ( 0.250000.*STATES(:,17))./(100.000./11.0000) }, 0.00000);
RATES(:,1) = ( CONSTANTS(:,2).*STATES(:,2)+ CONSTANTS(:,24).*ALGEBRAIC(:,6).*STATES(:,3)+ CONSTANTS(:,3).*STATES(:,4)) - ( CONSTANTS(:,1).*ALGEBRAIC(:,1).*STATES(:,1)+ CONSTANTS(:,23).*STATES(:,1));
RATES(:,3) = ( CONSTANTS(:,4).*STATES(:,2)+ CONSTANTS(:,26).*STATES(:,5)+ CONSTANTS(:,6).*STATES(:,7)) - ( CONSTANTS(:,25).*ALGEBRAIC(:,1).*STATES(:,3)+ CONSTANTS(:,24).*ALGEBRAIC(:,6).*STATES(:,3)+ CONSTANTS(:,5).*STATES(:,3));
RATES(:,6) = CONSTANTS(:,5).*STATES(:,5) - ( CONSTANTS(:,6).*STATES(:,6)+ CONSTANTS(:,8).*ALGEBRAIC(:,6).*STATES(:,6));
RATES(:,7) = CONSTANTS(:,5).*STATES(:,3) - ( CONSTANTS(:,6).*STATES(:,7)+ CONSTANTS(:,8).*ALGEBRAIC(:,6).*STATES(:,7));
RATES(:,9) = (( CONSTANTS(:,9).*STATES(:,8).*(STATES(:,5)+STATES(:,3)))./CONSTANTS(:,10)+ CONSTANTS(:,11).*STATES(:,12)) - ( CONSTANTS(:,27).*ALGEBRAIC(:,6)+ CONSTANTS(:,29).*STATES(:,11)).*STATES(:,9);
ALGEBRAIC(:,5) = ( 0.200000.*STATES(:,17)+ 0.800000.*STATES(:,19))./CONSTANTS(:,22);
ALGEBRAIC(:,7) = (40.0000./60.0000 - 4.00000./96.0000).*CONSTANTS(:,15).*ALGEBRAIC(:,5);
RATES(:,20) = ( CONSTANTS(:,15).*STATES(:,21)+CONSTANTS(:,35)) - ( (CONSTANTS(:,34)+ALGEBRAIC(:,7)).*STATES(:,20)+ CONSTANTS(:,16).*STATES(:,20));
RATES(:,21) = - CONSTANTS(:,15).*STATES(:,21)+ (CONSTANTS(:,34)+ALGEBRAIC(:,7)).*STATES(:,20);
ALGEBRAIC(:,8) = piecewise({STATES(:,4)+STATES(:,6)+STATES(:,7)>1.00000e-13, 10.0000.*CONSTANTS(:,7) }, 60.0000.*CONSTANTS(:,7));
RATES(:,4) = (ALGEBRAIC(:,8)+ CONSTANTS(:,8).*ALGEBRAIC(:,6).*(STATES(:,6)+STATES(:,7))+ CONSTANTS(:,23).*STATES(:,1)) - ( CONSTANTS(:,7).*STATES(:,4)+ CONSTANTS(:,3).*STATES(:,4));
ALGEBRAIC(:,9) = ( CONSTANTS(:,17).*power(STATES(:,19), CONSTANTS(:,19)))./(power(CONSTANTS(:,18), CONSTANTS(:,19))+power(STATES(:,19), CONSTANTS(:,19)));
RATES(:,8) = (( CONSTANTS(:,27).*ALGEBRAIC(:,6).*STATES(:,9) - ( CONSTANTS(:,9).*STATES(:,8).*(STATES(:,5)+STATES(:,3)))./CONSTANTS(:,10))+ CONSTANTS(:,36).*STATES(:,10)) - CONSTANTS(:,28).*ALGEBRAIC(:,9).*STATES(:,8);
RATES(:,10) = CONSTANTS(:,28).*ALGEBRAIC(:,9).*STATES(:,8) - CONSTANTS(:,36).*STATES(:,10);
RATES = RATES';
end
% Calculate algebraic variables
function ALGEBRAIC = computeAlgebraic(ALGEBRAIC, CONSTANTS, STATES, VOI)
statesSize = size(STATES);
statesColumnCount = statesSize(2);
if ( statesColumnCount == 1)
STATES = STATES';
utilOnes = 1;
else
statesRowCount = statesSize(1);
utilOnes = ones(statesRowCount, 1);
end
ALGEBRAIC(:,1) = piecewise({VOI<15.0000, 1.00000e-07 }, 0.00000);
ALGEBRAIC(:,2) = ( (CONSTANTS(:,21) - CONSTANTS(:,37)).*STATES(:,12))./CONSTANTS(:,38)+CONSTANTS(:,37);
ALGEBRAIC(:,3) = ( 0.100000.*CONSTANTS(:,32).*(STATES(:,13) - 0.310000))./(3.10000 - 0.310000);
ALGEBRAIC(:,4) = ( 0.100000.*CONSTANTS(:,33).*(STATES(:,13) - 0.310000))./(3.10000 - 0.310000);
ALGEBRAIC(:,6) = piecewise({STATES(:,17)<=400.000./11.0000||ALGEBRAIC(:,1)>=1.00000e-07, 1.00000 - ( 0.250000.*STATES(:,17))./(100.000./11.0000) }, 0.00000);
ALGEBRAIC(:,5) = ( 0.200000.*STATES(:,17)+ 0.800000.*STATES(:,19))./CONSTANTS(:,22);
ALGEBRAIC(:,7) = (40.0000./60.0000 - 4.00000./96.0000).*CONSTANTS(:,15).*ALGEBRAIC(:,5);
ALGEBRAIC(:,8) = piecewise({STATES(:,4)+STATES(:,6)+STATES(:,7)>1.00000e-13, 10.0000.*CONSTANTS(:,7) }, 60.0000.*CONSTANTS(:,7));
ALGEBRAIC(:,9) = ( CONSTANTS(:,17).*power(STATES(:,19), CONSTANTS(:,19)))./(power(CONSTANTS(:,18), CONSTANTS(:,19))+power(STATES(:,19), CONSTANTS(:,19)));
end
% Compute result of a piecewise function
function x = piecewise(cases, default)
set = [0];
for i = 1:2:length(cases)
if (length(cases{i+1}) == 1)
x(cases{i} & ~set,:) = cases{i+1};
else
x(cases{i} & ~set,:) = cases{i+1}(cases{i} & ~set);
end
set = set | cases{i};
if(set), break, end
end
if (length(default) == 1)
x(~set,:) = default;
else
x(~set,:) = default(~set);
end
end
% Pad out or shorten strings to a set length
function strout = strpad(strin)
req_length = 160;
insize = size(strin,2);
if insize > req_length
strout = strin(1:req_length);
else
strout = [strin, blanks(req_length - insize)];
end
end
