bugGNU Octave - Bugs: bug #54722, Publishing document with sections...

 
 

bug #54722: Publishing document with sections does not carry over variables

Submitter:  - <_102371>
Submitted:  Tue 25 Sep 2018 02:19:08 AM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  3 - Low Item Group:  Unexpected Error or Warning
Status:  Fixed Assigned to:  siko1056
Originator Name:  Open/Closed:  * Closed
Release:  * 4.4.1 Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 25 Sep 2018 11:22:07 PM UTC, comment #2: 

Thank you, it seems to be working fine!

- <_102371>
Tue 25 Sep 2018 09:22:06 AM UTC, comment #1: 

Thank you for reporting this bug.  In the upcoming version of Octave, the publish function has been overhauled and uses an improved method to store the variables and solves your problem publishing the given script.

See changeset http://hg.savannah.gnu.org/hgweb/octave/rev/af43eb4e6502
for details.

As publish is a pure m-File, you can even now get in the comfort of this new function.  Just download the recent publish m-File:

https://hg.savannah.gnu.org/hgweb/octave/raw-file/tip/scripts/miscellaneous/publish.m

and replace it in you current Octave installation, for example in

   C:\Octave\Octave-4.4.1\share\octave\4.4.1\m\miscellaneous

Can you report back here, if this works for you?

Kai Torben Ohlhus <siko1056>
Group Member
Tue 25 Sep 2018 02:19:08 AM UTC, original submission:  

I recently realised that octave has a publish() function. I was trying to see if I could publish some scripts from my research in Octave. It appears to me that if your script contains sections (separated by %%), then any variable or function declared in any previous section is not available to the following sections. .

As an example, put the following lines in a script and publish the script:


clc;
clear;
close all;
%% 1. Plot a Sin()

myFun = @(t) sin(2*pi*2*t);
fs = 100;
t = (0:99)/fs;
x = myFun(t);
figure;
plot(t, x);
%% 2. Plot Sin^2()
y = myFun(t).^2;
figure;
plot(t, y);


This would generate an HTML file with the following error:

2. Plot Sin^2()

y = myFun(t).^2;
figure;
plot(t, y);

error: 't' undefined near line 3 column 11
        in:
y = myFun(t).^2;
figure;
plot(t, y)


It appears to me as if each section is run independently when being published. However, just running the script results in no issues. Publishing the same script in MATLAB works without any problems.

- <_102371>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Digest:
   bug dependencies.

 

Carbon-Copy List
  • -email is unavailable- added by siko1056 (Posted a comment)
  • -email is unavailable- added by _102371 (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-09-26 siko1056 StatusWorks For Me Fixed
        Open/ClosedOpen Closed
    2018-09-25 siko1056 Dependencies- bugs #54723 is dependent
    2018-09-25 siko1056 Priority5 - Normal 3 - Low
        StatusNone Works For Me
        Assigned toNone siko1056

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code