Mercurial > octave-nkf
view examples/code/fortransub.f @ 20611:40ed9b46a800
new octave_value::string_value method with optional error message
* ov.h (octave_value::string_vector): New method.
ov-base.cc, ov-base.h (octave_base_value::string_vector):
New default method.
ov-str-mat.cc, ov-str-mat.h (octave_char_matrix_str::string_value):
New method.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 08 Oct 2015 16:43:22 -0400 |
parents | c8240a60dd01 |
children |
line wrap: on
line source
subroutine fortransub (n, a, s) implicit none character*(*) s real*8 a(*) integer*4 i, n, ioerr do i = 1, n if (a(i) .eq. 0d0) then call xstopx ('fortransub: divide by zero') else a(i) = 1d0 / a(i) endif enddo write (unit = s, fmt = '(a,i3,a,a)', iostat = ioerr) $ 'There are ', n, $ ' values in the input vector', char(0) if (ioerr .ne. 0) then call xstopx ('fortransub: error writing string') endif return end