필터 지우기
필터 지우기

How to define an array with fractional index number in MATLAB?

조회 수: 7 (최근 30일)
Udit Srivastava
Udit Srivastava 2016년 12월 14일
답변: Adam 2016년 12월 14일
How to define an array with fractional index number in MATLAB?
  댓글 수: 5
José-Luis
José-Luis 2016년 12월 14일
My thought exactly.
Use a function of two variables.
Udit Srivastava
Udit Srivastava 2016년 12월 14일
basically, i have to define an array with fractional index like p(r(i),z(j))

댓글을 달려면 로그인하십시오.

답변 (2개)

KSSV
KSSV 2016년 12월 14일
편집: KSSV 2016년 12월 14일
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

Adam
Adam 2016년 12월 14일
'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.

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by