【发布时间】:2016-12-04 23:07:10
【问题描述】:
我正在尝试运行一些简单的 octave 脚本,但我遇到了以下问题。
假设我的脚本中有错误 A。当我尝试运行此脚本时,octave 报告我在第 10 行第 10 列中看到错误 A。我注释掉此行并尝试再次运行脚本,但 octave 继续在第 10 行第 10 列中报告错误 A 10.
所以,现在是代码。
我的主要脚本包含以下内容:
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()
当plotter_obj.draw() 被调用时,下面的类应该可以工作:
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 报如下错误:
错误:'len' 在第 18 行第 20 列附近未定义
错误:从
调用 在第 18 行第 18 列绘制
rg_chromacity_based_wavelet_transform 在第 15 行第 1 列
但是在 draw 方法中不再提到 len 符号。
我可以摆脱错误消息的唯一方法是关闭 octave 并重新启动它。
会发生什么?我应该在修改我的类方法后以某种方式重置我的工作环境吗?
【问题讨论】:
-
在这里发布您的代码!