How can I add a zero element to a cell array?
2 次查看(过去 30 天)
显示 更早的评论
Hi everyone, I have two cell arrays as:
B=[1*44997] and time=t=[1*44998]. The values in B are zero, 1 and -1. I would like to assign a zero value to the last element of B so that I would be able to plot B as a function of (t) because there are not the same length. How can I make two cell array the same dimension?
采纳的回答
the cyclist
2016-5-16
B = [B,0]
3 个评论
Guillaume
2016-5-17
If it worked, then your question was very misleading as you do not have cell arrays, but plain matrices. As per Jan's comment, please read the documentation on cell arrays.
the cyclist
2016-5-17
编辑:the cyclist
2016-5-17
Not necessarily true, Guillaume. That syntax will also work with cell arrays. For example, this is a valid MATLAB statement
C = [{'a',1,'b'},0]
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Multidimensional Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!