Ignore:
Timestamp:
Dec 20, 2008, 2:51:08 PM (16 years ago)
Author:
dkearney
Message:

updating octave and matlab example code to take advantage of vector operations to write data to rappture library object. this helps with large arrays, you no longer need to iterate over each element in the array and write elements one by one.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/examples/app-fermi/octave/fermi.m

    r665 r1260  
    4141rpLibPutString(lib,"output.curve(f12).yaxis.units","eV",0);
    4242
    43 for j=1:200
    44   rpUtilsProgress((j/200*100),'Iterating');
    45   putStr = sprintf('%12g  %12g\n', f(j), E(j));
    46   % put the data into the xml file
    47   rpLibPutString(lib,"output.curve(f12).component.xy",putStr,1);
    48 end
     43% this is a slow and inefficient method of putting
     44% large amounts of data back in to the rappture library object
     45%for j=1:200
     46%  rpUtilsProgress((j/200*100),'Iterating');
     47%  putStr = sprintf('%12g  %12g\n', f(j), E(j));
     48%  % put the data into the xml file
     49%  rpLibPutString(lib,"output.curve(f12).component.xy",putStr,1);
     50%end
     51
     52% a better way is to take advantage of octave's vector operations.
     53outData = [f;E];
     54putStr = sprintf('%12g  %12g\n', outData);
     55rpLibPutString(lib,'output.curve(f12).component.xy',putStr,0);
    4956
    5057% signal the end of processing
Note: See TracChangeset for help on using the changeset viewer.