Error: File: d3.m Line: 7 Column: 10 Invalid use of operator.

2 visualizaciones (últimos 30 días)
Hansu Kim
Hansu Kim el 7 de Oct. de 2020
Respondida: James Tursa el 7 de Oct. de 2020
datacell = textscan( regexprep( fileread('cricketData.csv'), '\$', '0' ), '%f%f', 'delimiter', ',', 'HeaderLines', 1);
Duration = datacell{1};
Input = datacell{1};
YourTable = table(Duration, Input);
temp=datacell(:,1);
rate=datacell(:,2);
scatter((:,1)),(:,2)),'o')
xlabel('temperature(T in degrees Fahrenheit)')
ylabel('chirping (R in chirp per second))')
title('Chirping rate vs Temperature')
p=polyfit(datacell(:,1),datacell(:,2),1);
x=min((datacell(:,1)))-2:.01:max((datacell(:,2)))+2;
hold on
plot(x,polyval(p,x))
legend('Data points,''best fit equation')
fprintf('Calculated equation: Chirping rate(c/s)=(%.2f)(temperature (F))+%.2f\n',p)

Respuestas (2)

Walter Roberson
Walter Roberson el 7 de Oct. de 2020
scatter((:,1)),(:,2)),'o')
The : operator needs to have a variable or constant on each side if it when it is being used as the range-construction operator.
When : is used as a subscript by itself, then it needs to appear inside an indexing expression. For example,
scatter(rate(:,1),(2:5)),'o')
| |
| +--- range operator
|
+---- subscript operator

James Tursa
James Tursa el 7 de Oct. de 2020
Looks like you are missing some variable names and some matching parentheses in this line:
scatter((:,1)),(:,2)),'o')

Categorías

Más información sobre Numeric Types en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by