Uz = unzip('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1514334/Script.zip')
Uz =
{'ofih1.txt'} {'ofih2.txt'} {'ofih3.txt'} {'Script.m'}
fullname = strcat(name,'%d.txt');
isp = 'Specific impulse I_{sp} [s]';
ispof = 'Specific impulse versus mixture ratio';
cstar = 'Characteristic velocity c* [m/s]';
cstarof = 'Characteristic velocity versus mixture ratio';
of = 'Mixture ratio (o/f)_m';
A = readFixedWidthFile(fn{k});
D{k,:} = A(1:size(A,1)-3,:);
plot(D{k}(:,1), D{k}(:,2))
legend(fn,'Location','best')
plot(D{k}(:,1), D{k}(:,3))
legend(fn,'Location','best')
plotting('isp',isp,ispof,2,D,fn,of);
D
{21×3 double}
{18×3 double}
{ 8×3 double}
fn
{'ofih1.txt'}
{'ofih2.txt'}
{'ofih3.txt'}
of
Mixture ratio (o/f)_m
plotting('cstar',cstar,cstarof,3,D,fn,of);
D
{21×3 double}
{18×3 double}
{ 8×3 double}
fn
{'ofih1.txt'}
{'ofih2.txt'}
{'ofih3.txt'}
of
Mixture ratio (o/f)_m
function [] = plotting(name1,name2,name3,n,D,fn,of)
plot(D{k}(:,1), D{k}(:,n))
legend(fn,'Location','best')
function DataMatrix = readFixedWidthFile(filename)
opts = fixedWidthImportOptions('NumVariables',3, 'VariableWidths',[15 16 16], 'DataLines',[4 25; 27 28]);
T1 = readtable(filename, opts);
T2 = varfun(@(x)fillmissing(x,'constant',{'NaN'}), T1);
DataMatrix = str2double(table2array(T2));