syntax for "if"

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

syntax for "if"

Edward C. Jones
I have a piece of MatLab code that I am running in Octave:

if ~isempty(subp),
    subplot(subp);
end

If I change it to:

if ~isempty(subp),
    disp(subp);
    subplot(subp);
end

The behavior is quite different. Have I used "if" incorrectly?



-------------------------------------------------------------
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
-------------------------------------------------------------


Reply | Threaded
Open this post in threaded view
|

syntax for "if"

John W. Eaton-6
On 19-Mar-2005, Edward C. Jones <[hidden email]> wrote:

| I have a piece of MatLab code that I am running in Octave:
|
| if ~isempty(subp),
|     subplot(subp);
| end
|
| If I change it to:
|
| if ~isempty(subp),
|     disp(subp);
|     subplot(subp);
| end
|
| The behavior is quite different. Have I used "if" incorrectly?

How is it different?  As far as I can tell, both bits of code work
properly for me.

If you have a bug to report, please send a complete report to
[hidden email].  To find out how to submit a report that
will be useful for solving the problem, please read
http://www.octave.org/bugs.html.

Thanks,

jwe



-------------------------------------------------------------
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
-------------------------------------------------------------