Effacer les filtres
Effacer les filtres

i have made an excel sheet which has values in 1st column and 'yes'/'no' in the 2nd. i want to extract values which show 'no' and display it. how can i do that?

1 vue (au cours des 30 derniers jours)
this is the code i was using but ts not working.
data2=readtable("convergencecheck5.xlsx");
A=table2cell(data2);
k=data2{:,2};
k1=string(k);
switch k1
case 'no'
print(k1)
end

Réponses (1)

Cris LaPierre
Cris LaPierre le 2 Nov 2023
I'd do this
data2=readtable("convergencecheck5.xlsx","TextType","string")
data2.Values(data2.Converge=="no")
You haven't shared your file, so this is more of a template that a guaranteed working example. There is no need to convert you table to a cell. See the Access Data in Tables page to learn how to work with tables.
I have assumed your first table variable (column) is called "Values" and your second variable name is "Converge". These should be whatever column heading you have in your file. If you print out data2 you will see the names used in MATLAB. If you don't have column headings, it will be "Var1" and "Var2".
I then use logical indexing to extract and display the values that have a corresponding "no". Just note that, for this comparison, capitalization matters.

Catégories

En savoir plus sur Tables dans Help Center et File Exchange

Tags

Produits


Version

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by