using an array in a for loop

4 visualizzazioni (ultimi 30 giorni)
Steve
Steve il 10 Apr 2013
I want to take an array containing a variable amount of numbers and append each number onto a name that is already defined. I want these names to be stored in a new array to be used later.
for array [0:i]
NewNameArray[i] = DefinedName + array(i);
end

Risposta accettata

PT
PT il 10 Apr 2013
array = 1:100;
newarray = cell(length(array),1);
for i = 1:length(array)
newarray(i) = {['Name' num2str(array(i))]};
end

Più risposte (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by