Inconsistent Find Function output
8 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I have been having some issues with using the find function in Matlab app designer. The gist of my problem is that running my code through Matlab app designer creates a different value then when I run it in a regular script. I have gone through to make sure all the code is correct and I have wittled down the problem to when the find function is used.
My app designer code is this:
dataCar = table2array(cell2table(all'));
dataSorted{k} = (find(agSd{k}==sortrows(dataCar(:,2),'descend'),1))+(find(agDel{k}==sortrows(dataCar(:,3)),1));
my script code is this:
carData = table2array(cell2table(all'));
sortedData{k} = (find(avgSpeed{k}==sortrows(carData(:,2),'descend'),1))+(find(avgDelta{k}==sortrows(carData(:,3)),1));
As you can see they are essentially the same code, but with some variable names changed so I could compare the two. In addition, this is embedded in a for loop hence the "k" as the indexing variable.
The dataCar and carData variables are the exact same array of data and they all have matching values. Also, the agSd and agDel are the exact same values as avgSpeed and avgDelta.
However, with those values being the same, the dataSorted and sortedData cells do not match.
Would there be any reason why, in app designer, the code produces incorrect and different values than the script code?
I have even exported the variables and values from the app designer to my matlab workspace, and I have plugged the dataSorted equation into the command window and I got matching values to the script code. So, I am pretty bewildered and flustered over this.
Any and all information is appreciated!
4 Commenti
Stephen23
il 22 Giu 2023
"However, with those values being the same"
Most likely they are different values. Until you upload the exact data you are using in both cases (by clicking the paperclip button) we can safely assume that they are not the same values: different calculations generating different values.
Highly recommended reading:
Risposte (0)
Vedere anche
Categorie
Scopri di più su Develop Apps Using App Designer in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!