Fortran to matlab code

조회 수: 1 (최근 30일)
Matlabuser
Matlabuser 2014년 11월 12일
댓글: Matlabuser 2014년 11월 17일
Hi everyone, I have a code in fortran and I want to convert that code in matlab. But problem is that, in fortran I have I=-N+1:N+1;
But in matlab, If I take the negative no. I have the problem of indexing. Can anyone please tell me, how I can solve this problem?
Thanks

채택된 답변

Torsten
Torsten 2014년 11월 12일
If you mean
I=-(N+1):(N+1)
then shift the indices by N+2 for the MATLAB application.
Then in_Matlab I will be I=1:(2*N+3)
Best wishes
Torsten.
  댓글 수: 2
Matlabuser
Matlabuser 2014년 11월 12일
Thank you Torsten !!!
Matlabuser
Matlabuser 2014년 11월 17일
a=-N+2
i=-N+1,N-1
p(i)=p(a)-p(a-2)
a=a+1
I did not know how to change this in matlab

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Fortran with MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by