MATLAB Please write the code for this question.

8 views (last 30 days)
Write a program to administer a computerized questionnaire on a topic of interest to you. Use a structure data type and allow participants to answer with whole sentences or phrases for at least some items. Save the data in an external file. Record the time to answer each question.
tic'What is your name?','s');
Subject.age=input('How old are you?','s');
Subject.hobby=input('What is your hobby?','s');
Subject.favorite=input('What is your favorite food?','s')
I have to use tic-toc.please help me T.T
  1 Comment
Walter Roberson
Walter Roberson on 28 Mar 2021
You have to record the time to answer each question, so you need a tic/toc around each input() call. And you need to store the value of the toc() call.

Sign in to comment.

Answers (1)

Mahesh Taparia
Mahesh Taparia on 30 Mar 2021
You can use tic - toc function and store the time into some variable as given below:
tic = input('What is your name?','s');
nameTime = toc;
Subject.age = input('How old are you?','s');
ageTime = toc;
Subject.hobby = input('What is your hobby?','s');
hobbyTime = toc;
Subject.favorite = input('What is your favorite food?','s');
favTime = toc;
Hope it will help!
Walter Roberson
Walter Roberson on 31 Mar 2021
But we can discuss how to do it without giving the complete solution, or by showing a single example that does not directly work so that they would have to understand the ideas rather than copying directly.

Sign in to comment.


Find more on Get Started with MATLAB in Help Center and File Exchange


Community Treasure Hunt

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

Start Hunting!