I am trying to create a GUI where multiple variables could be modified using sliders. This is my example this far: I'm trying to alter the gradient of a linear function by summing two sliders.
I am completely new to the gui of octave and matlab, so I assume there is some fundamental error.
%%%%%% In file myplot.m %%%%%
function myplot
%% Create initial figure and spiral plot
figure;
axes ('position', [0.1, 0.3, 0.8, 0.6]);
global t;
t = linspace (0, 100, 101)
x = t;
y = t;
plot (x, y);
axis ([-100, 100, -100, 100]);
%% Add ui 'slider' element
hslider = uicontrol ( ...
'style', 'slider', ...
'Units', 'normalized', ...
'position', [0.1, 0.1, 0.8, 0.1], ...
'min', -100, ...
'max', 100, ...
'value', 0, ...
'callback', {@plotstuff} ...
);
%% Add ui 'slider' element
kslider = uicontrol ( ...
'style', 'slider', ...
'Units', 'normalized', ...
'position', [0.1, 0, 0.8, 0.1], ...
'min', -100, ...
'max', 100, ...
'value', 0, ...
'callback', {@plotstuff} ...
);
end
%% Callback function called by slider event
%% Also in file myplot.m (i.e. a subfunction)
function plotstuff (h, k, event)
global t;
n = get (h, 'value');
m = get (k, 'value');
x = t;
y = (n+m) * t ;
plot (x, y);
axis ([-100, 100, -100, 100]);
end
This is my error message:
㎫ >> error: operator *: nonconformant arguments (op1 is 0x0, op2 is 1x101) error: called from octave_test>plotstuff at line 43 column 5 error: operator *: nonconformant arguments (op1 is 0x0, op2 is 1x101) error: called from octave_test>plotstuff at line 43 column 5
This is the figure window:
