How do I get my script to produce a 2-D array?

1 view (last 30 days)
The script should display a 2-dimensional array with n-rows and two columns: The first column should display the years from 0 to n. The second column should display the account balance at the end of each corresponding year.

Accepted Answer

Rick Rosson
Rick Rosson on 3 Feb 2015
n = 30;
X = zeros(n+1,2);
X(:,1) = 0:n;
X(:,2) = ...
Rick Rosson
Rick Rosson on 3 Feb 2015
Edited: Rick Rosson on 3 Feb 2015
dur = input('the investment duration in years:');
time = 0:dur;
result = [ time account_balance ];

Sign in to comment.

More Answers (0)


Find more on Visual Exploration 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!