[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Re: matlab and octave
From: |
goberr |
Subject: |
Re: Re: matlab and octave |
Date: |
Tue, 18 Nov 2003 10:05:56 -0500 |
A geeker (and possibly slightly faster) way would be:
> ---- ismatlab.m
function out = ismatlab()
%% Return 1 if you are in matlab and 0 if you are in octave
%% This uses the very long output of command version under matlab
%% This is not very clean but it is quickly checked
out = (length(version) > 10)
end
>
> From: Laurent Jacques <address@hidden>
> Date: 2003/11/18 Tue AM 07:43:07 EST
> To: "A. S. Budden" <address@hidden>
> CC: address@hidden
> Subject: Re: matlab and octave
>
> Try something with the help of the following function which works under
> octave
> and matlab.
>
> Laurent.
>
> ---- ismatlab.m
> function out = ismatlab()
> %% Return 1 if you are in matlab and 0 if you are in octave
> %% This uses the very long output of command version under matlab
> %% This is not very clean but it is quickly checked
> info=version;
> if (length(version) > 10)
> out = 1;
> else
> out = 0;
> end
> ----
>
> And a simple test which works too under matlab and octave:
>
> ---- test.m
> function test()
>
> if (ismatlab)
> plot(1:5);
> else
> plot(1:5);
> replot;
> end
> ----
>
>
> On Tuesday 18 November 2003 13:17, A. S. Budden wrote:
> | Hi there,
> |
> | I use both octave and matlab a lot -- octave on my laptop and matlab on
> | the university machines. Is there any way of adding lines into a .m
> | file such that either matlab or octave (mainly the former) will ignore
> | the command. For example, I have a file with the line replot --
> | this seems to be required in octave to update the gnuplot window.
> | However, matlab generates an error message if I run it there. I realise
> | I could make a function called replot that does nothing in matlab and
> | put it in a central store, but this could get messy if there are a lot
> | of functions that are required.
> |
> | Also, I've found that the axis command doesn't seem to work very well in
> | octave. In my .m file I have a function plot_ab (at the end of this
> | email). The line ax=axis returns [-1.8131 1.3346 -0.9580 1.5246] in
> | matlab and the plot virtually fills the window. In octave, ax=axis
> | returns [-10 10 -10 10] and the plot is only about 1/10 the size of the
> | window.
> |
> | Can anyone offer any suggestions with either of these problems?
> |
> | Many thanks in advance,
> |
> | Al
> |
> |
> | function plot_ab(parametera, parameterb);
> | % Plot first parameter against second parameter with fixed axis
> | % for i=1:size(parametera,1)
> |
> | for i=1:size(parametera,1),
> | plot(parametera(i,:), parameterb(i,:), 'b-', 0,0,'bx');
> | if ( i==1 )
> | axis('equal');
> | replot;
> | % Add 50% on to each axis and remember
> | ax = axis;
> | if (abs(ax(1)) > abs(ax(2)))
> | ax(2) = -ax(1);
> | else
> | ax(1) = -ax(2);
> | end;
> | if (abs(ax(3)) > abs(ax(4)))
> | ax(4) = -ax(3);
> | else
> | ax(3) = -ax(4);
> | end;
> | ax = ax*1.2;
> | axis(ax)
> | axis('equal');
> | replot;
> | ax = axis;
> | end;
> | axis(ax);
> | xlabel('\alpha Axis Current');
> | ylabel('\beta Axis Current');
> | pause(0.1);
> | end;
> |
> |
> |
> | -------------------------------------------------------------
> | Octave is freely available under the terms of the GNU GPL.
> |
> | Octave's home on the web: http://www.octave.org
> | How to fund new projects: http://www.octave.org/funding.html
> | Subscription information: http://www.octave.org/archive.html
> | -------------------------------------------------------------
>
>
>
> -------------------------------------------------------------
> Octave is freely available under the terms of the GNU GPL.
>
> Octave's home on the web: http://www.octave.org
> How to fund new projects: http://www.octave.org/funding.html
> Subscription information: http://www.octave.org/archive.html
> -------------------------------------------------------------
>
>
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------
- Re: matlab and octave, (continued)
- Re: matlab and octave, Geraint Paul Bevan, 2003/11/18
- Re: matlab and octave, David Bateman, 2003/11/18
- Re: matlab and octave, Geraint Paul Bevan, 2003/11/18
- Re: matlab and octave, David Bateman, 2003/11/18
- Re: matlab and octave, John W. Eaton, 2003/11/18
- Re: matlab and octave, Carlo de Falco, 2003/11/23
Re: matlab and octave, Miquel Cabanas, 2003/11/18
Re: matlab and octave, Andy Adler, 2003/11/18
Re: matlab and octave, A. S. Budden, 2003/11/19
Re: Re: matlab and octave,
goberr <=