Program Examples:Sci Lab interface

From SoftMC-Wiki
Revision as of 13:21, 6 March 2017 by Miborich (talk | contribs) (Created page with "Example for function of reading softMC record file from SciLab (64bit). <syntaxhighlight lang="scilab"> global rec rec = []; function MCplot(name) global rec fid = mo...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Example for function of reading softMC record file from SciLab (64bit).

global rec 
rec = [];

function MCplot(name)
global rec
     fid = mopen(name,'rb');
     n   = mget(1,'i',fid);
     m   = mget(1,'i',fid);
     gap = mget(1,'i',fid);
     vlen= mget(1,'i',fid);
     var = mgetstr(vlen,fid);
     n = modulo(n,16);
     rec = zeros(m,n);
          
     for i = 1:m
       for j = 1:n
     	 tmp = mget(1,'d',fid);
     	 rec(i,j) = tmp;
     	end
     end
     mclose(fid);
endfunction
  • 32bit version is the same just instead "i" identifier in mget the "l" identifier is used.

The function is invoked as (draws 3D trajectory) :

MCplot('C:\SoftMC\Projects\test.rec')
parm3d(rec(:,1),rec(:,2),rec(:,3));