Update the number of columns needed for my times table
5 次查看(过去 30 天)
显示 更早的评论
Hello, when I convert my csv file to a timestable, it's saying there are 67 columns when there should be 65 columns. I want to update the Variable Names and its not allowing me to edit the headers in the table without editing all the variables. When I attempt it, i get this error: "Conversion to cell from char is not possible." How do I count the number of columns in a timestable to then be able to delete the excess columns left over at the end of the table so that I can update the variableNames? I'm still fairly new to MATLAB and dealing with an older version so I'm having trouble with this.
1 个评论
Stephen23
2024-9-12
"How do I count the number of columns in a timestable to then be able to delete the excess columns left over at the end of the table so that I can update the variableNames?"
I doubt that you need to count them:
N = 5; % number of required columns
T = array2table(randi(9,4,7)) % extra columns
T(:,N+1:end) = []
Note that you might lose data.
采纳的回答
Star Strider
2024-9-12
It would heelp to have your .csv file and a description of what you want to do. Also, it might be easiier to do this in a table and then use table2timetable to convert it to a timetable.
If you only want to edit one variable name, that is straightforward —
T1 = array2table(randi(50,5))
T1.Properties.VariableNames{3} = 'Column 3'
Just choose the one you want to change.
.
更多回答(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!