Difference between revisions of "Program Examples:Sci Lab interface"
(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...") |
|||
Line 1: | Line 1: | ||
+ | {{Languages}} | ||
Example for function of reading softMC record file from SciLab (64bit). | Example for function of reading softMC record file from SciLab (64bit). | ||
Revision as of 07:29, 17 July 2017
Language: | [[::Program Examples:Sci Lab interface|English]] • [[::Program Examples:Sci Lab interface/zh-hans|中文(简体)]] |
---|
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));