How to store users input in a file?
Let’s say I made a input asking for the users name and age, and wanted to say his input to a .txt file, I already know how to do that but my issue is how to keep that stored data if the script was ran again.
my code to store the users name and age:
name = input(‘What is your name? ‘,’s’);
age = input(‘How old are you? ‘);
fid = fopen(‘data.txt’,’w’);
fprintf(fid,’%s is %i years oldn’,name,age);
fclose(fid);Let’s say I made a input asking for the users name and age, and wanted to say his input to a .txt file, I already know how to do that but my issue is how to keep that stored data if the script was ran again.
my code to store the users name and age:
name = input(‘What is your name? ‘,’s’);
age = input(‘How old are you? ‘);
fid = fopen(‘data.txt’,’w’);
fprintf(fid,’%s is %i years oldn’,name,age);
fclose(fid); Let’s say I made a input asking for the users name and age, and wanted to say his input to a .txt file, I already know how to do that but my issue is how to keep that stored data if the script was ran again.
my code to store the users name and age:
name = input(‘What is your name? ‘,’s’);
age = input(‘How old are you? ‘);
fid = fopen(‘data.txt’,’w’);
fprintf(fid,’%s is %i years oldn’,name,age);
fclose(fid); input MATLAB Answers — New Questions