[Top][All Lists]

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

Re: How to keep print compatiable with MATLAB

From: Joe Koski
Subject: Re: How to keep print compatiable with MATLAB
Date: Sun, 25 Apr 2004 21:57:45 -0600
User-agent: Microsoft-Entourage/

on 4/25/04 9:02 PM, David Bateman at address@hidden wrote:

> According to Etienne Grossmann <address@hidden> (on 04/25/04):
>>   Hello,
>> what about sthing like:
>>   if exist ("octave_config_info")
>>     ## Octave code
>>   else
>>     ## Matlab code
>>   end
> I prefer to test for OCTAVE_VERSION, but hey. You might need to also
> use "eval" of functions that exist in Octave and not matlab and
> vis-a-versa to avoid parse errors. For instance your example would
> become
> if exist ("octave_config_info")
> %plot frequency response
> N = 16634;
> [h, f] = freqz(B, A, N, fs);
> eval('gset terminal windows');
> eval('gset title "A-weighting Cureve Frequecny Response"');
> eval('gset grid');
> eval('gset nokey');
> semilogx(f, 20*log10(abs(h)));
> %print plot to PNG pic file
> eval('gset terminal png');
> eval('gset output "myplot.png"')
> replot
> else
> % Matlab code
> end
Just a quick observation. If Octave and Matlab were compiled instead of
interpreted, this approach wouldn't be possible at all. A compiler would
choke when it saw the other language's instruction set in the if statement.
Are there potential syntax checking problems that could derail this

Joe Koski

Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

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