How to add columns with fixed values to their exact position in the table
조회 수: 4 (최근 30일)
이전 댓글 표시
Hello, I have a table with 16 columns. Some columns have variable value and some have fixed value.
I fixed their values like:
simtable.datacenters(:)="Cloud_1";
Now, This column is at no. 4 in my table. but, when printing output it gets printed at last.
I also want to generate its excel sheet but the columns with fixed values are not added to excel sheet.
Thank you.
댓글 수: 0
채택된 답변
Abderrahim. B
2022년 7월 18일
편집: Abderrahim. B
2022년 7월 18일
Hi,
Use addvars instead of dot notation to add columns to your table.
Demo:
load patients
T = table(Age,Gender,Smoker) ;
% add a new column to T table before Age
T = addvars(T,LastName,'Before','Age')
Hope this helps
댓글 수: 10
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Spreadsheets에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!