to display current time along side each element of a vector . need to implement it in the program below.

1 view (last 30 days)
x=[];
fprintf('Enter the size of array');
n=input('');
for i=1:n
r=rand;
x(i)=r;
end
disp(x);
  2 Comments
Rik
Rik on 8 Apr 2019
This code will execute in a very short time, even if it can be sped up. What is the goal? Displaying the current time during the loop is possible (see the now function), but will not really make sense. Do you want to store the time in the same array as your data?
Tanushree Swain
Tanushree Swain on 8 Apr 2019
i want to display the element and beside it the current time.yes i want to store it in the same array as my data.

Sign in to comment.

Accepted Answer

Steven Lord
Steven Lord on 8 Apr 2019
If you want to store your data in an array where each data point has a time and date associated with it, use a timetable.

More Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!