I want to plot the data as shown. but it is giving error as : Error using plot Conversion to double from cell is not possible.
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Sachin Patil
le 12 Sep 2016
Modifié(e) : Sachin Patil
le 13 Sep 2016
fid = fopen('C:\Users\1319146\Downloads\data.txt');
textLine = fgets(fid); % Read first line.
lineCounter = 1;
while ischar(textLine)
numbers = sscanf(textLine, '%f ');
x= length(numbers);
for k = 1 : x
ca{lineCounter, k} = numbers(k);
end
textLine = fgets(fid);
lineCounter = lineCounter + 1;
end
fclose(fid);
c2 = ca(:,2);
[n,p] = size (c2);
t = 1:n;
plot(t,c2);
legend('Location 1','Location','NorthWest')
xlabel('Time'), ylabel('distance')
%c2=
[ 1.3589]
[ 7.9773]
[28.2728]
[28.2728]
[ 0]
[ 0]
[ 0]
[ 0]
[ 0]
[ 0]
[]
[ 0.8705]
[ 7.4681]
[28.2728]
[37.0303]
[ 0]
[ 0]
[ 0]
[ 0]
[ 0]
[ 0]
0 commentaires
Réponse acceptée
Star Strider
le 12 Sep 2016
I cannot run your code to test this.
See if this works:
plot(t,c2{:});
Not the curly brackets ‘{}’ in the ‘c2’ reference.
1 commentaire
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Sources dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!