[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
a help problem
From: |
Vic Norton |
Subject: |
a help problem |
Date: |
Mon, 28 Nov 2016 07:30:03 -0500 |
I am running Homebrew Octave 4.2.0 on an iMac OS X 10.12.1. Everything
works perfectly except this curious test script.
########## begin script #################
% test1.m
% Why doesn't this message show up when I do
% octave> help test1
% unless I remove one % from each of the double-% lines
chdir (fileparts(mfilename("fullpath")));
printf("hello world\n");
load XYTable.mat XY; % XYTable.mat contains the 2 x 9 lookup table XY
%%{
function y = x2y(XY, x)
y = 0;
i1 = lookup(XY(1, :), x);
if i1 == 0; return; endif
i0 = i1 + 1;
x0 = XY(1, i0); x1 = XY(1, i1);
y0 = XY(2, i0); y1 = XY(2, i1);
y = y0 + (y1 - y0) * ((x - x0) / (x1 - x0));
endfunction % x2y
x = 27
y = x2y(XY, x)
%%}
%{
% XYTable.mat:
# Created by Octave 4.2.0, Wed Nov 23 16:00:00 2016 EST <address@hidden>
# name: XY
# type: matrix
# rows: 2
# columns: 9
42.4530 35.4921 29.4225 28.3286 26.8788 26.7901 23.3404 22.6220 18.2069
26.5579 16.2450 8.40148 7.51666 6.73955 6.70094 5.21504 4.91929 3.29878
%}
########### end script ################
When I do
octave> help test1
I see
'test1' is a script from the file /Users/vicnorton/...
x2y
Additional help for built-in functions …
Executing the script:
octave> test1
produces
hello world
x = 27
y = 6.8045
If I remove a % from both of the double-% lines and write
octave> help test1
I get
'test1' is a script from the file /Users/vicnorton/...
test1.m
Why doesn't this message show up when I do
octave> help test1
unless I remove one % from each of the double-% lines
Additional help for built-in functions …
But now executing
octave> test1
simply produces the line
hello world
Why do I only get the help-description of the script when I comment out
the x2y function? Something very strange is going on here.
How do I create a lookup function without destroying the functionality
of the leading help-description of my script?
Any suggestions would be much appreciated.
Regards,
Vic
test1.m
Description: Binary data
XYTable.mat
Description: Binary data
- a help problem,
Vic Norton <=