how to return first 5 digits of 6th column in cell array?
2 次查看(过去 30 天)
显示 更早的评论
Hi Matlab community,
Here's another newbie question. I would like to replace the 6th column with the first 5 digits of that column (20134); I would then like to create a 7th column that is the last digit of the 6 column. Here's a sample array.
Thank-you for your help.
cell = {'this' 'is' 'a' 'cell' 'array' '2013420134' }
0 个评论
采纳的回答
更多回答(1 个)
Jos (10584)
2014-4-6
C = {'this' 'is' 'a' 'cell' 'array' '2013420134' }
V = C{6} % retrieve the 6th cell
C{6} = V(1:5) % replace it
C{7} = V(end) % add a new cell
btw, avoid giving your variable the same name as a matlab function
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Environment and Settings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!