Error in interp1 (line 117) extptids = Xq < X(1) | Xq > X(end);

10 visualizzazioni (ultimi 30 giorni)
error : Index exceeds matrix dimensions.
Error in interp1 (line 117) extptids = Xq < X(1) | Xq > X(end);
Error in get_clk_corr (line 22) err = interp1(sp3.data(jj,sp3.col.TOW),sp3.data(jj,sp3.col.B),tsat,'linear',NaN);
Error in PreciseGPSReceiverPosition (line 113) PRN_obs = get_clk_corr(PRN_obs, sp3);
Input files obs and sp3 are structures. I have copied the structure data into excel and attached here.
  7 Commenti
Lakshmi Chodavarapu
Lakshmi Chodavarapu il 7 Ago 2018
Thank you so much Mr.Stephen Cobeldick and Mr.Walter Roberson. I am learning MATLAB myself (of course with the help of internet resources) while using it. Grateful to you for your valuable suggestions and surely will follow.
Lakshmi Chodavarapu
Lakshmi Chodavarapu il 28 Ago 2018
Can any one kindly suggest me how to solve this problem. I am still struggling with it. Kindly :(

Accedi per commentare.

Risposta accettata

Stephen23
Stephen23 il 28 Ago 2018
Modificato: Stephen23 il 28 Ago 2018
The problem is very simple: the index jj is empty, so you are trying to interpolate empty data (which clearly is impossible: how do you expect to interpolate data that does not exist?).
Why is jj empty? Because the condition you wrote is never true. This is easy to test:
>> index = find(sp3.data(:,sp3.col.PRN)==PRN_obs.data(:,PRN_obs.col.PRN));
>> any(sp3.data(index,sp3.col.B)<1e4)
ans = 0
Because none of the values of sp3.data in the rows give in index are less than 1e4, then jj is empty.
As you have not written any code comments, help, links, or explanation then I have no idea what the solution is: perhaps you have to handle this special case somehow, perhaps your algorithm is flawed, perhaps your code is buggy... in any case, you now know why jj is empty, and how easy this is to check.
Note that your loop to generate jj is very inefficient, because you expand jj within the loop. It is simpler to just use logical indexing:
jj = index(sp3.data(index,sp3.col.B)<1e4)
  2 Commenti
Lakshmi Chodavarapu
Lakshmi Chodavarapu il 28 Ago 2018
You saved my life Sir, I am grateful to you. Learned a lot! There are 999999.9999 in bad/absent data points for which the condition is failing. I am really grateful to you for teaching me how to investigate this error. Thanks again with great gratitude.
Walter Roberson
Walter Roberson il 28 Ago 2018
There are 999999.9999 in bad/absent data points
We recommend you do not look for those using numeric equality. If that key value is above the range of valid values, then test against the valid range, such as sp3.data > 500000 . If there could be valid values with larger magnitude, then test for this particular value using ismembertol() rather than testing for equality: if you test for equality you will miss any values that happen to be one bit off due to floating point representation difficulties.

Accedi per commentare.

Più risposte (0)

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by