I'm getting an opperator error on line 179. At this point I have a for loop where I say:
for idxGPS > 1 ;
Earlier in the code I declare idxGPS = 1. After that I have another for loop where I have data being stored in that variable so for this loop that original value of 1 should be overwritten if the previous loop processed correctly.

2 个评论

Copying question in case it gets edited away or deleted as this user has done to several previous questions.
"I'm getting an opperator error on line 179. At this point I have a for loop where I say:
for idxGPS > 1 ;
Earlier in the code I declare idxGPS = 1. After that I have another for loop where I have data being stored in that variable so for this loop that original value of 1 should be overwritten if the previous loop processed correctly."

请先登录,再进行评论。

 采纳的回答

In MATLAB, a for statement must have one of the following syntaxes:
  • for variable = scalar_value : scalar_value
  • for variable = scalar_value : scalar_value : scalar_value
  • for variable = scalar_value
  • for variable = nonscalar_value
In the above, variable_name must be a simple un-indexed name.
In the above, scalar_value and nonscalar_value can be expressions that evaluate to a scalar value or nonscalar value.
Basically, the syntax is really just
for variable = expression
except that the cases with : are optimized internally.
It would thus be valid to write
for control = idxGPS > 1
As your idxGPS is scalar numeric, idxGPS > 1 would be scalar, either 0 (false) or 1 (true), and that value would be assigned to the variable for one iteration.
If you wanted to only do the body once if the condition held, and for some reason you really had an urge to use a for instead of the more straight-forward if then you could do
for control = true : idxGPS > 1
That would do the body of the loop once and only in the case that idxGPS > 1
Your code is missing a bunch of "end" statements, and appears to have improper nesting.
Your code uses otherwise which is restricted for use in a switch() statement, but you are not using a switch statement.
If you have a hankering to execute exactly one of those sections in an obscure but legal way, then
switch true
case idxGPS > 1
stuff
case idxGLONASS > 1
stuff
otherwise
stuff
end

7 个评论

Thank you! I changed the for loops to if statements. I'm now getting a new error on line 250. I have attached the updated code. The error says that this statement is not inside any function. I've gotten this error before but I'm not entirely sure why.
Are you sure that you only want to test idxGLONASS > 1 in the case that idxGPS > 1, and that idxGALILEO should only be tested if idxGLONASS and idxGPS are true?
You should go into the editor and command-A and then click on Smart Indent to see how all of your control structures line up. Your current indentation is confusing you.
No I want them all to tested even if one isnt true. To do that should I end the first if statement with GPS prior to starting the one with GLONASS? and do the same for the other constellations as well.
My newest version of the code runs with no error but I belive one of the loops is a forevor loop bc the code never stops running. I attached an updated version to this message
Line 209 contains
ephemeris matirx for all satellites (nx24), with columns of
which is not a comment.
I still have a while loop but I'm going to try and add counter that exits the loop.

请先登录,再进行评论。

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Communications Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by