MATLAB: Generate a general structure

generate structurestruct

Hello,
I'm looking for a way to generate a general structure in a function that looks like this in the end
Structure
Name1= 1 Name2= 2
My solution so far is
Function erzeugeStructure(n)
For b=1:n
Struct('Feldnamen',{b})
End End
I would appreciate your help

Best Answer

n = 3 ;
iwant = struct ;
for i = 1:n
iwant(i).name = i ;
end
iwant(1)
iwant(2)