Error in interp1 (line 117) extptids = Xq < X(1) | Xq > X(end);
10 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Lakshmi Chodavarapu
il 6 Ago 2018
Commentato: Walter Roberson
il 28 Ago 2018
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
Risposta accettata
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
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.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Matrix Indexing in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!