Variable for table are in one row and not one column. How do I turn it or save a variable in one column?
조회 수: 12 (최근 30일)
이전 댓글 표시
Very Basic but i just cant find the answer to my problem. Looking for 2 Solutions.
- How do I safe data in one column and not one row?
- How can I change the orientation in the table even if my varibales are in one row?
data = [1:number]
t = table(data,'VariableNames',{'Set number'})
Results:
Set Number
1 2 3
What I am looking for:
Setnumber
1
2
3
댓글 수: 0
채택된 답변
Ameer Hamza
2020년 11월 29일
편집: Ameer Hamza
2020년 11월 29일
You can use the transpose operator
data = (1:number).';
or indexing
data = 1:number;
data = data(:)
or reshape()
data = reshape(1:number, [], 1)
To only change the orientation in the table
data = 1:number
t = table(data.','VariableNames',{'Set number'})
or any of the above mentioned options.
댓글 수: 0
추가 답변 (1개)
KSSV
2020년 11월 29일
number = 3 ;
data = [1:number]'
t = table(data,'VariableNames',{'Set number'})
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Structures에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!