how to make dot-plot of table?
49 次查看(过去 30 天)
显示 更早的评论
Hello!
I have a table file where I want to plot just the numeric data in a dot plot
Here is the table1:
scan1 scan2 scan3
subject 1 2 1 1
subject 2 1 NaN 2
subject 3 2 2 NaN
I turn my table into a cell and then into a mat file in order to be able to make a dotplot.
numbers = table2cell(table1)
numbers = cell2mat(numbers)
scatter(numbers(:,1), numbers(:,2), numbers(:,3))
where my error is:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1058425/image.png)
I want my final figure to look as follows:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1058430/image.png)
0 个评论
采纳的回答
Walter Roberson
2022-7-7
If you are using a quite recent version of MATLAB, then
scatter3(table1, 'scan1', 'scan2', 'scan3')
Otherwise,
scatter3(table1.scan1, table1.scan2, table1.scan3)
3 个评论
Walter Roberson
2022-7-7
R2019b does not support scatter3() of table variables, so you will need that second form that I posted.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Graphics Object Programming 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!