How to convert multiple tables into matrices

7 vues (au cours des 30 derniers jours)
Viet-Anh Do
Viet-Anh Do le 17 Juin 2020
Commenté : Ameer Hamza le 18 Juin 2020
Hello Folks,
I'm trying to write a function, which converts every inputs as table in matrices. I used to use myTable{:,:} to do this for single input. Now it doesn't work anymore.

Réponse acceptée

Ameer Hamza
Ameer Hamza le 17 Juin 2020
For dealing with multiple tables, it is best to create a cell array
T = {myTable1, myTable2, myTable3};
Then you can function such as cellfun to create a cell array of matrices
M = cellfun(@(x) {x{:,:}}, T); % implicit for-loop
or create a single large matrix
M = [M{:}]; % connect horizontally
M = vertcat(M{:}); % connect vertically
  8 commentaires
Viet-Anh Do
Viet-Anh Do le 17 Juin 2020
Thank you. It works! You save my ass today.
Ameer Hamza
Ameer Hamza le 18 Juin 2020
I am glad to be of help! :)

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Data Type Conversion 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