Creating a for loop that adds a number to a letter
2 次查看(过去 30 天)
显示 更早的评论
Hi,
I'm trying to create a for loop that adds a number to a letter every time it loops. Here is my current code:
for count=1:99;
CM1=count;
CM2=count+1;
CM1X=['X',CM1]
CM2X=['X',CM2]
end
The problem that I am having is the X prints out fine, but the numbers print out as letters and then numbers and then characters. Here is what I am getting:
CM1X=
X
CM2X=
X .
.
.
CM1X=
X"
CM2X=
X/
and so on
Please help I'm not to sure what is going on.
0 个评论
采纳的回答
更多回答(2 个)
bym
2013-3-8
for insight into what is going on try
char(1:99)
does it look familiar to what you are getting?
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!