MATLAB: Naming a structure with a string that was fetched through x=input(prompt)

namesstringstructures

My code looks like this so far:
prompt = 'What is the name of your project? '
% projectname becomes the entered string
projectname = input(prompt,'s')
% a structure with the string as name should be generated
projectname = struct()
Unfortunatly the name of the structure stays "projectname" and won't become the string.
Thanks for anything that might help.

Best Answer

You do not want to do that. It should be the contents of a variable that is flexible and not the name. Assuming you want to store some data for this project you could use the following approach
M.projectname = input('What is the name of the project','s')
M.data = cumsum(randi(10,1,15)) ;
% and then for instance
plot(M.data,'bo-') ; title(M.projectname)