Concatenate the index i within the loop
2 views (last 30 days)
Show older comments
Amanda Camarata
on 9 Dec 2023
Commented: Dyuman Joshi
on 9 Dec 2023
I'm trying to create a list for my legend without hard coding it, but I'm having trouble figure out how to concatenate the number associated with 'i' in my loop.
I'm hoping I'll end up with a list of strings = ['Node 1','Node 2','Node 3'....]
num_labels = 10;
labels = zeros(1,num_labels);
for i = 1:num_labels
labels(1,i) = strcat('Node',i);
end
1 Comment
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Axis Labels in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!