Roman
Roman

Reputation: 1466

Octave does not recognise changes in .m files

I'm trying to run some simple octave scripts, but I face the following issue.

Suppose I have an error A in my script. When I try to run this script, octave reports me that it sees error A in, say, line 10, column 10. I comment out this line and try to run script again, but octave continues to report error A in line 10, column 10.

So, now the code.

my main scrips contains following:

clear; clc;

#test_image_path = "/home/roman/Documents/prog/Prototype/project/resources/image/1.jpg";
test_image_path = "/home/roman/Documents/prog/Prototype/project/resources/image/3x3.jpeg";

plotter_obj = plotter();

source_image = imread(test_image_path);
plotter_obj.add_plot(source_image);

xyz_image = custom_image_conversion_routines.rgb2ciergb(source_image);
plotter_obj.add_plot(xyz_image);

plotter_obj.draw()

When plotter_obj.draw() is called, following class should work:

classdef plotter < handle
  properties (Hidden, SetAccess = protected)
    column_no = 0;
    row_no = 0;
    plots = {}; 
  end

  methods
    function obj = plotter()
      disp('plotter created');
    end

    function add_plot(obj, plot)
      obj.plots{end + 1} = plot;
    end

    function draw(obj)
      vector_len = size(obj.plots)
      grid_axis_size = ceil(sqrt(vector_len));

      for index = 1:vector_len
        subplot(grid_axis_size, grid_axis_size);
        imshow(obj.plots{index});
      endfor
    end

  end

end

Octave reports the following error:

error: 'len' undefined near line 18 column 20
error: called from
draw at line 18 column 18
rg_chromacity_based_wavelet_transform at line 15 column 1

But there's no len symbol mentioned in draw method anymore.

The only way I can get rid of the error message, is to shutdown octave and restart it.

What happens? Am I supposed to reset my working environment in some way after modifying my class method?

Upvotes: 2

Views: 771

Answers (1)

Suever
Suever

Reputation: 65430

If you make a change to a class, you likely need to clear that class for the changes to take effect.

clear -classes

Upvotes: 4

Related Questions