Effacer les filtres
Effacer les filtres

Remove table columns that contain any 'Inf' value

6 vues (au cours des 30 derniers jours)
chiefjia
chiefjia le 6 Oct 2021
Réponse apportée : C B le 6 Oct 2021
Dear MATLAB experts,
I'm trying to remove all columns from a table that contain (once or more) so called 'Inf' values. I have tried the code below so far, but it has not worked. Thank you in advance.
stock_returnsTable = stock_returnsTable(:,~any(isinf(stock_returns)));

Réponses (1)

C B
C B le 6 Oct 2021
modified = stock_returnsTable{:,:}
output = modified(:, all(~isinf(modified), 1))
stock_returnsTable =
5×4 table
A B C D
__ ___ ___ ___
71 176 Inf 12
69 163 163 163
64 131 131 131
67 133 133 133
64 Inf 33 33
modified =
71 176 Inf 12
69 163 163 163
64 131 131 131
67 133 133 133
64 Inf 33 33
output =
71 12
69 163
64 131
67 133
64 33

Catégories

En savoir plus sur Logical 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!

Translated by