MATLAB: How to write a loop that spells the word “aluminum,” adding one letter at a time
incremental for looping for strings
Answer should appear similar to this: a al alu alum alumi alumin aluminu aluminum
Best Answer
>> S = 'aluminium';
>> for k = 1:numel(S), disp(S(1:k)), end
a
al
alu
alum
alumi
alumin
alumini
aluminiu
aluminium
If you actually want to learn how to write your own MATLAB code and not just get other people to do your homework for you, then you should do these tutorials:
Best Answer