0
votes

I have no matlab or mathematical experience but i would like to do the following :

  • convert an excel file to a tab delimited file and open this in matlab organized in the following way: every row is a new subject first colum is name of subject other 8 columns are the parameters for each subject

  • I would like to run a growthfunction on each subject and obtain the following results the maximum velocity and corresponding growth and time the minimum velocity before the maximum velocity is reached and corresponding time and growth the maximum growth (the function nears an asymptot)

-This is the code that I would use

tmin=0;
tmax=20;
dt=1
t=tmin:dt:tmax;
y = m1.*(1-1./(1+(m2.*(t+m8)).^m5+(m3.*(t+m8)).^m6+(m4.*(t+m8)).^m7));
dy=diff(y)./dt;
max(dy);
min(dy);
imax=find(dy==max(dy))+1;
imin=find(dy==min(dy))+1;
t(imax);
t(imin);
y(imax);
y(imin);
y(20);

Where do i put this code so that it knows that m1 to m8 are corresponding to the different columns in my file? how do i link these? How can i make sure that the output of each subject appears in a column in my tab delimited file (like excel)

In brief what I would like to do: have a file with on every row a new subject and column 2-9 are the values of the parameters m1 to m8. Run the formula so that in column 9 i will have the maximum velocity, in 10 the minimum velocity and so one...

Can anyone help me out

Thanks

2

2 Answers

0
votes

you can just import the data by double clicking the xls file. A dialog should appear. Select the data range that you want to import.

you can then simply state untitled(:,1) = m1 etc.

0
votes

[~,~,rawData]=xlsread('yourExcelSheet.xlsx')

SubjectNames=rawData(:,1) % I think () is better here than { }, may have to switch this up.

Data=cell2mat(rawData(:,2:9)) % convert the last 8 columns (2 to 9) to a matrix of type double %This ^^ also assumes there are no headers in excel, if there are headers, it would be %rawData(2:end,2:9) instead of what I have above

m1=Data(:,2) m2=Data(:,3) % etc. etc. m8=Data(:,9)

alternatively, if you can get over the messiness, substitute "Data(:,2)" in your equation instead of m1, it will give you a tiny speedup

Disclaimer: I just wrote all this off the top of my head, if it errors, hopefully its just something small, otherwise let me know.