Saving user input and write into .csv file?

Hello, I am wondering whether it would be possible to save the user input and write into .csv?
prompt={'weight','hight','birth date'};
dlgtitle='Input';
dims=[1 35];
definput={'120kg','170cm','1998/5/2'};
answer = inputdlg(prompt,dlgtitle, dims, definput);
Thanks

답변 (1개)

JESUS DAVID ARIZA ROYETH
JESUS DAVID ARIZA ROYETH 2020년 2월 7일

0 개 추천

solution:
writecell(answer,'myfilename.csv')
and for get the file after you can use:
readcell('myfilename.csv')

댓글 수: 3

This requires r2019b or later.
For earlier versions
https://www.mathworks.com/matlabcentral/answers/503384-xlswrite-overwrites-data-despite-setting-a-specific-range#answer_413819 lists other possibilities
steamrice
steamrice 2020년 2월 9일
@Walter Roberson I was reading your early post but I am not too sure which one would help me achieve my goal. I am thinking to have that fix column of specific inputs (data information and its changingable). When the user enter that specific inputs and after some data analysis, those data information can also write into the .csv with the corresponding data.
steamrice
steamrice 2020년 2월 10일
Thanks for the response!
I think you mentioned, "I need to emphasize that this cannot be used to add new columns to a csv file."
Does that mean its not possbile to combine the user input from prompt with the after-data-anaylsis into the same .csv?

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 MATLAB에 대해 자세히 알아보기

제품

태그

질문:

2020년 2월 7일

댓글:

2020년 2월 10일

Community Treasure Hunt

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

Start Hunting!

Translated by