How do I create a user modified profile database?
古いコメントを表示
How do I create a user (profile name) updated database that updates everytime a new name is added, and will also allow the user to erase their profile if needed? This information will be used to title and store excel data and personal data.
4 件のコメント
Geoff Hayes
2015 年 3 月 22 日
George - how is this a MATLAB question? Are you creating a MATLAB GUI that will allow a user to create a profile that you wish to save to some database using SQL or is it much simpler and you just want to save this information to file? Please provide more details.
George
2015 年 3 月 22 日
Geoff Hayes
2015 年 3 月 22 日
George - please post your code so that we can provide some guidance.
George
2015 年 3 月 22 日
編集済み: Geoff Hayes
2015 年 3 月 22 日
回答 (1 件)
Geoff Hayes
2015 年 3 月 22 日
George - you should check out the link debugging in MATLAB as it will provide some very useful tips on how to debug your code.
If I try to run the above as a new user, then once I type in my name, the following error message appears
Undefined function or variable "index".
because of the line of code
profile_names{index} = user_name;
The local variable index is only ever assigned if the user does not enter Y or N and the body of the while loop is invoked. (As an aside when comparing string data, use strcmpi or strcmp instead of the equality or inequality operators.) It isn't clear to me why index is assigned in this loop - it seems very unnecessary. Instead, just use counter as
if strcmpi(userinput,'y')
user_name = input('\n\nplease enter name: ','s');
profile_names{counter} = user_name;
counter = counter + 1;
else
old_profile = input('Please enter name of profile: ','s');
end
Now try doing something similar for the else body in the above code (which presumably is meant to remove the user account).
カテゴリ
ヘルプ センター および File Exchange で Startup and Shutdown についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!