필터 지우기
필터 지우기

Tables: Join on numeric keys

조회 수: 2 (최근 30일)
Christoph
Christoph 2015년 11월 25일
편집: Kirby Fears 2015년 11월 25일
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
Kirby Fears
Kirby Fears 2015년 11월 25일
편집: Kirby Fears 2015년 11월 25일
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.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Cell Arrays에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by