I have this scilab code to compute MSD, and I want it to be an executable program:
fileID = mopen('file001.txt','r');
sample = mfscanf(-1,fileID,'%i');
//initialize variables and arrays
nData = size(sample,1);
numberOfDeltaT = floor(nData/4);
msd = zeros(numberOfDeltaT,2);
deltaCoords = cell(nData,1);
//compute MSD then store in array
for dt = 1:numberOfDeltaT
deltaCoords = sample(1+dt:$) - sample(1:$-dt);
squaredDisplacement = sum(deltaCoords.^2,2);
msd(dt,1) = mean(squaredDisplacement);
msd(dt,2) = length(squaredDisplacement);
I want the input to be the file to be read, and will produce the MSD plot.
How do I do this? Should I start with
function = calc_MSD(inputFile)?
I also want the
for loop to be using
parfor. Is this possible in scilab?
You may see the scetoexe toolbox here that facilitates what you are asking for. First see if you could get a simple code converted to an executable before you try it on your program.