Kyla Hollenbeck
Kyla Hollenbeck

Reputation: 1

Why am I getting this plotting error on Octave?

This is my script on Octave.

function      filePlot(filename,graphTitle,xAxisLabel,yAxisLabel)
  
raw_data=load(filename);
  
  % Assign the first column of raw_data to x, and the 2nd to y
  
x=filename(:,1);
  
y=filename(:,2);
  
% Create a scatter plot of the fish counts vs. the gas concentration
  
plot(x,y)
  
% Add appropriate graph title and axis labels
  
xlabel(xAxisLabel)
  
ylabel(yAxisLabel)
  
title(graphTitle)
  
% For both x and y, display the mean standard deviation in the the command window 
  
mean(std(x));
  
mean(std(y));

endfunction

I keeping getting this error.

error: plot: no data to plot

error: called from
    
__plt__ at line 127 column 11
    
plot at line 229 column 10
    
filePlot at line 8 column 3

I don't understand what I am doing wrong.
Please Help

Upvotes: 0

Views: 129

Answers (1)

John R. Strohm
John R. Strohm

Reputation: 7667

I think you want

x=raw_data(:,1);

and

y=raw_data(:,2);

Upvotes: 1

Related Questions