Code Monkey home page Code Monkey logo

Comments (9)

da-liii avatar da-liii commented on July 28, 2024 1

I think detection of plot changes should be provided by octave itself. We need to discuss the details with the octave community.

from octave.

woutersj avatar woutersj commented on July 28, 2024

See this commit

from octave.

da-liii avatar da-liii commented on July 28, 2024

The digest is for detecting whether the ans is changed. Create PR and I will carefully review the changes.

from octave.

da-liii avatar da-liii commented on July 28, 2024

How about solving this issue by forcing the display when the last line of the the statements is a plot/imshow/... function call?

from octave.

da-liii avatar da-liii commented on July 28, 2024

@woutersj How about 00a8f11 ?

Just re-impl the plot part. Have fun!

from octave.

woutersj avatar woutersj commented on July 28, 2024

Thanks @sadhen! I really like your solution of searching for plot functions.
It seems isplot doesn't work for multiline input. I'll add some tests to plots.tm.

from octave.

da-liii avatar da-liii commented on July 28, 2024

For multiline input, currently, it is evaled at once. I know the flaws. But I don't want to do more string manipulation on octave code. There seems no official support of meta programming in octave.

from octave.

woutersj avatar woutersj commented on July 28, 2024

I think it should be possible to detect plot changes based on serialize, but we would need to traverse the figure tree instead of serializing the top figure node.
I have been experimenting a bit and I think something like this could work:

function rets = traverse(node,s)
  rets = s;
  if ~isempty(node)
    for i = 1:length(node.children)
      rets = traverse(get(node.children(i)),rets);
    endfor
    rets = strcat(rets,"\n");
  endif
  rets = strcat(rets,serialize(node),"\t");
endfunction

Then we can do traverse(get(get(groot, "currentfigure")),"") to get a string for the entire tree.

However, the tree contains function handles, which serialize.m cannot handle, so there should be some more changes made there. Perhaps the func2str function can be useful.

from octave.

woutersj avatar woutersj commented on July 28, 2024

It seems this might work to detect any changed figures:

function h = fighash(id)
  fig_struct = hdl2struct (id);
  save_header_format_string("","local")
  h = hash("md5",save("-","-struct","fig_struct"));
endfunction

arrayfun("fighash",get(0,"children"), "UniformOutput", false)

from octave.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.