Error: File: d3.m Line: 7 Column: 10 Invalid use of operator.
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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)
0 comentarios
Respuestas (2)
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
0 comentarios
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')
0 comentarios
Ver también
Categorías
Más información sobre Numeric Types en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!