Connect datapoints in Plot

2 次查看(过去 30 天)
Hi there
so i have a Dataset which I'm plotting. Now i wanna try to connect the single datapoints with a line so it's more of a graph than just single points.
I found the function line(); in another post.
Is there a mistake in my code or can I not use it this way ?
Or are there any other better fitting solutiouns to this ?
So far this is my code:
daten = readtable("datasetexperiment1.csv");
scatter(datasetexperiment1,"Times","vms");
line("Times","vms",'LineStyle','-');
Thanks ahead
Pascal

采纳的回答

Dave B
Dave B 2021-10-19
编辑:Dave B 2021-10-19
Unfortunately, not all plotting functions accept table variables in MATLAB yet (scatter was one of the first of the 'traditional' plotting functions that we added table support to in R2021b).
So for the time being, you can use plot (I strongly recommend that over line), but you'll need to specify the values rather than the table variables. Your code would look like:
daten = readtable("datasetexperiment1.csv");
scatter(daten,"Times","vms");
hold on
plot(daten.Times, daten.vms);
Note that plot can also include markers, so you could just do:
daten = readtable("datasetexperiment1.csv");
plot(daten.Times, daten.vms,'-o');

更多回答(0 个)

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by