Create a character cell in ascending order
1 次查看(过去 30 天)
显示 更早的评论
i want to create a cell of 1000*1 , containing the strings in ascending order.
Let's say variable1, variable2,....variable999,variable1000. How can i do that with for loop?
0 个评论
采纳的回答
madhan ravi
2019-1-9
编辑:madhan ravi
2019-1-9
With loop:
for i =1:1000
{sprintf('variable%d',i)} % if you remove { } it's string array
end
Without loop:
compose('variable%d',(1:1000).') % cell array
compose("variable%d",(1:1000).') % string array
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Cell Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!