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/matlab/uncompiled/fermi.m

    r1222 r1260  
    4646rpLibPutString(lib,'output.curve(f12).yaxis.units','eV',0);
    4747
    48 for j=1:200
    49   rpUtilsProgress((j/200*100),'Iterating');
    50   putStr = sprintf('%12g  %12g\n', f(j), E(j));
    51   % put the data into the xml file
    52   rpLibPutString(lib,'output.curve(f12).component.xy',putStr,1);
    53 end
     48% this is a slow and inefficient method of putting
     49% large amounts of data back in to the rappture library object
     50%for j=1:200
     51%  rpUtilsProgress((j/200*100),'Iterating');
     52%  putStr = sprintf('%12g  %12g\n', f(j), E(j));
     53%  % put the data into the xml file
     54%  rpLibPutString(lib,'output.curve(f12).component.xy',putStr,1);
     55%end
     56
     57% a better way is to take advantage of matlab's vector operations.
     58outData = [f;E];
     59putStr = sprintf('%12g  %12g\n', outData);
     60rpLibPutString(lib,'output.curve(f12).component.xy',putStr,0);
    5461
    5562% signal the end of processing
Note: See TracChangeset for help on using the changeset viewer.