Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/fortran/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Matlab 冒号在fortran中是什么意思?_Matlab_Fortran - Fatal编程技术网

Matlab 冒号在fortran中是什么意思?

Matlab 冒号在fortran中是什么意思?,matlab,fortran,Matlab,Fortran,我正在尝试将fortran代码转换为matlab,我想知道是否有人可以帮助我完成这个子程序。 我特别想问的是,这些行中的冒号是什么意思 SUB Taper (a(), co(), Re(), Im()) FOR nd = 0 TO 31 n1 = 8 * nd: n2 = a(n1 + 4): n1 = a(n1): n0 = 255 - nd a = .5 * (1 - co(n1)): b = .5 * (1 - co(n2)) Re

我正在尝试将fortran代码转换为matlab,我想知道是否有人可以帮助我完成这个子程序。 我特别想问的是,这些行中的冒号是什么意思

SUB Taper (a(), co(), Re(), Im())

FOR nd = 0 TO 31

         n1 = 8 * nd: n2 = a(n1 + 4): n1 = a(n1): n0 = 255 - nd
         a = .5 * (1 - co(n1)): b = .5 * (1 - co(n2))
         Re(nd) = a * Re(nd): Im(nd) = b * Im(nd)
         Re(n0) = b * Re(n0): Im(n0) = a * Im(n0)

NEXT

END SUB

Fortran90及更高版本允许您访问给定索引的单个数组值,并访问给定由冒号分隔的索引范围的子数组

Fortran = Beginning : End : Increment
MatLab  = Beginning : Increment : End

第5页底部有一个表格,显示了Fortran和MatLab的等价物。

问题中的代码片段没有有效的Fortran语法。是VB,冒号用作

,看起来更像VB而不是Fortran。这是事实,Fortran中还有冒号编辑描述符。然而,这两个都不适用,因为代码片段不是Fortran。@francescalus-同意。所以,是的,它实际上是基本的,我一直以为它是Fortran!这就澄清了很多:P