I am working with mortality tables on MATLAB. My aim is to upload any (Mortality Table) data file in Matlab and calculate survival probabilities.
Unrecognized function or variable 'x'.
Error in lifetable (line 6) [a,elx] = lifetablefit(x,lx);
I have attached the datafile and I here is my code.
opts=detectImportOptions('lifetable2000CM.csv', 'PreserveVariableNames', true)
data = readtable('lifetable2000CM.csv',opts);
[a,elx] = lifetablefit(x,lx);
MATLAB works perfectly fine if I write
My aim is to to program any kind of lifetable in MATLAB. If anyone has experience in this area please help me out.