help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Suppress eval out put in "units.m"


From: Mech.Mon
Subject: Suppress eval out put in "units.m"
Date: Fri, 20 Apr 2012 12:58:05 -0700 (PDT)

Hello all,

I modified units.m to work on my system, now it works but the "eval ("
statement always prints now. Any way to suppress this output? For example:

14:49:04 :35> z= units("kg/m^3", "lb/ft^3", [996.2018,997.2018,998.2018])
y =

   62.191   62.253   62.316

z =

   62.191   62.253   62.316

14:49:18 :36>



function y = units(fromUnit, toUnit, x)
    if 2 > nargin || 3 < nargin || !ischar(fromUnit) || !ischar(toUnit)
        usage('units(fromUnit, toUnit [, x])')
    endif
    [status, rawoutput] = system(sprintf('C:\\GnuWin32\\bin\\units "%s"
"%s"', fromUnit, toUnit), 1);
    (0 == status) || error([rawoutput,
        'Verify that GNU units is installed in the current path.']);
    
    i = index(rawoutput, "*");
    j = index(rawoutput, "\n") - 1;
    i && (i < j) || error('parsing units output "%s"', rawoutput);

    exist("x", "var") || (x = 1);
        
    ###eval(['y=x', rawoutput(i:j), ';']);<---------Throws parse error
    eval(['y=x', rawoutput(i:j)]);#works but displays "y = ...."
endfunction


Regards,
Mon

-----
******
And AC said, "LET THERE BE LIGHT!"
"The Last Question" - Isaac Asimov
--
View this message in context: 
http://octave.1599824.n4.nabble.com/Suppress-eval-out-put-in-units-m-tp4575108p4575108.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]