필터 지우기
필터 지우기

How to separate Variables Names from the Data in Two Different table

조회 수: 2 (최근 30일)
Hello,
I have been able to read my excel file and to create my table using this code:
T = readtable('Data.xlsx','TextType','string');
I would like to separate them in 2 differents tables one with variables names and one with the data
because my list of variable name is very long.
like following:
varnames = ["Var1""Var2"..."VarN"]
data =["BOB" "london" "BIM" "Alfred" "Paris" "BOB" "John" "BOB" "CEF"]
Thanks for your understanding
Have a nice day.

채택된 답변

Star Strider
Star Strider 2021년 12월 11일
Perhaps something like this —
T1 = array2table(randi(99, 10, 5))
T1 = 10×5 table
Var1 Var2 Var3 Var4 Var5 ____ ____ ____ ____ ____ 66 94 35 1 7 80 65 87 94 7 18 90 14 99 88 23 29 23 14 46 55 58 31 61 57 97 52 61 95 1 55 23 39 27 31 98 5 11 12 88 47 15 55 80 46 83 49 81 31 27
T2 = T1;
T2.Properties.VariableNames = {'Alpha','Beta','Gamma','Delta','Epsilon'}
T2 = 10×5 table
Alpha Beta Gamma Delta Epsilon _____ ____ _____ _____ _______ 66 94 35 1 7 80 65 87 94 7 18 90 14 99 88 23 29 23 14 46 55 58 31 61 57 97 52 61 95 1 55 23 39 27 31 98 5 11 12 88 47 15 55 80 46 83 49 81 31 27
Make appropriate changes to get the desired result.
.
  댓글 수: 4
Alikouider
Alikouider 2021년 12월 11일
Clear Ok
Thanks again
Good evening

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

추가 답변 (0개)

카테고리

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

태그

제품


릴리스

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by