how to make numbering near "a" like: a1, a2, an
    9 次查看(过去 30 天)
  
       显示 更早的评论
    
Hi,
Could you please tell me how to increase number near "a" so it could look like this:
b = 1; "ab = something" b = b + 1; ...
a1 = something; a2 = something; ... an = something;
2 个评论
采纳的回答
  Arthur
      
 2012-11-25
        Please don't use dynamic variable names, matlab has plenty of options to store your data in a better way. Use cells or structs.
3 个评论
  Image Analyst
      
      
 2012-11-25
				If the "a" are being assign to simple numbers (not to strings, structures, cells, etc.), then using a simple numerical array is best and easiest:
for k = 1 : 118
  a(k) = b;  % a is floating point array, unless you explicitly cast b to an integer type.
  b = b + 1; % Whatever.....
end
更多回答(1 个)
  moulay
 2012-11-25
        for example_:
    % for i=1:2:5
b=['a_'  num2str(i)]
end
is that waht are u looking for?
0 个评论
另请参阅
类别
				在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
			
	产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!