Using Scinotes and parfor


I have this scilab code to compute MSD, and I want it to be an executable program:

//open file
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);
//close file
//plot MSD

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?

Thank you!

Scilab Not Spam Edit Delete 05-02-20, 10:49 a.m. butiki

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.

Not Spam 05-02-20, 3:20 p.m. rupakrokade Delete Edit