Effacer les filtres
Effacer les filtres

Tables: Join on numeric keys

2 vues (au cours des 30 derniers jours)
Christoph
Christoph le 25 Nov 2015
Modifié(e) : Kirby Fears le 25 Nov 2015
Is there a way to do a join on tables using numeric variables as keys? I get the following error message:
Left and right key variables 'Key' and 'Key' include cells containing non-string values.
I know that I could maybe use something like num2str, but that does not seem very efficient, as I have to do it on large tables and inside loops (i.e. many times)...
  1 commentaire
Kirby Fears
Kirby Fears le 25 Nov 2015
Modifié(e) : Kirby Fears le 25 Nov 2015
This error often happens when you have a cell array containing some strings and some numbers.
If the Key variable is entirely numeric, try converting it to a double array using cell2num. If that fails, then you probably have strings and numeric data mixed together in your Key variable.
A double array or a cell array of strings should work as a Key variable. I'm not sure if a cell array of doubles works or not.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Cell Arrays dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by