First, note that in Matlab, the following square bracket notation: ['Hello', 'World']
, does not in fact create an array of string, but concatenates the strings "Hello" and "World" to yield 'HelloWorld'. So, in this case, you should use Cell Arrays instead: A = {'Hello', 'World'}
(note the curly brackets).
To answer your question:
Although you could go for something more generic (which you should in real-life code), for now, since you know the arrays of hand, you can simply create nested for
loops like this:
A = {'Bridge','No Bridge'};
B = {'Asphalt','Concrete','Combined'};
...
for aIndex = 1:length(A)
for bIndex = 1:length(B)
% add more loop levels here
fprintf([A{aIndex}, ',', B{bIndex}, '\n']);
end
end
With ouput:
Bridge,Asphalt
Bridge,Concrete
Bridge,Combined
No Bridge,Asphalt
No Bridge,Concrete
No Bridge,Combined