How to define an array with fractional index number in MATLAB?
7 views (last 30 days)
Show older comments
How to define an array with fractional index number in MATLAB?
5 Comments
Answers (2)
KSSV
on 14 Dec 2016
Edited: KSSV
on 14 Dec 2016
You cannot define fractional indices in any software.......fortran, c takes from 0 to n...where as matlab takes from 1 to n. May be you want to call a fractional array; you have to follow like this.
x = rand(10,1) ;
n = length(x) ;
for i = 1:n
x(i)
end
0 Comments
Adam
on 14 Dec 2016
'have to' for what purpose?
Use
doc containers.Map
if you want to set up a finite lookup table of results to index into without using integer lookups.
But if your code is sufficiently fast then a function works fine and recalculate whatever is asked for.
0 Comments
See Also
Categories
Find more on Matrix Indexing 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!