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:
I want my final figure to look as follows:

 Réponse acceptée

Walter Roberson
Walter Roberson le 7 Juil 2022

0 votes

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 commentaires

thanks for all of your help! I am using matlab2019b. I am getting an error that says:
not enough input arguments.
here is my actual table:
here is my code now:
%try1
scatter3(rad1_cap, 'T1MEMPRAGE', 'SWI', 'T2_', 'Flair')
and here is the second try:
scatter3(rad1_cap(:,2:5), 'T1MEMPRAGE', 'SWI', 'T2_', 'Flair')
Thanks so much!
Walter Roberson
Walter Roberson le 7 Juil 2022
R2019b does not support scatter3() of table variables, so you will need that second form that I posted.
Sorry, I forgot to mention that I had also tried:
scatter3(rad1_cap, rad1_cap.T1MEMPRAGE, rad1_cap.SWI, rad1_cap.T2_, rad1_cap.Flair)
scatter3(rad1_cap(:,2:5), rad1_cap.T1MEMPRAGE, rad1_cap.SWI, rad1_cap.T2_, rad1_cap.Flair)
but am getting the error:
inputs must be numeric, dateime, or categorical
any suggestions? sorry to be such a pain!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by