to display current time along side each element of a vector . need to implement it in the program below.
1 view (last 30 days)
Show older comments
x=[];
fprintf('Enter the size of array');
n=input('');
for i=1:n
r=rand;
x(i)=r;
end
disp(x);
2 Comments
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?
Accepted Answer
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.
0 Comments
More Answers (0)
See Also
Categories
Find more on Loops and Conditional Statements 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!