How to put a range of values into an array
Show older comments
So I have a range of values that need to go into an array so I can then add a second range to each element of the array. It's not a range of values I can just manually type out; it's a range of sizes, and then on each value for each size, I need to add on a range of colors. I just have no idea how to do this; I'm completely new to Matlab and have no idea what I'm doing.
Accepted Answer
More Answers (1)
KSSV
on 4 Feb 2021
Read aboout linspace.
xo = 1 ; x1 = 10 ;
x1 = linspace(x0,x1,500) ; % creates 500 points between 1 and 10
dx = 0.1 ;
x2 = x0:dx:x1 ; % creates elements with a difference of dx
Categories
Find more on Logical in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!