View full-text article in PMC Sensors (Basel). 2019 Jun 3;19(11):2538. doi: 10.3390/s19112538 Search in PMC Search in PubMed View in NLM Catalog Add to search Copyright and License information © 2019 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/). PMC Copyright notice Algorithm 1 Floor Identification Using Magnetic Data 1:Input: magnetic data M, User phone orientation O 2:fori⟵1to5do 3: Sm⟵transformMagData(Oi,Mi); 4: for j⟵Nb do 5: Ed⟵calEucDistance(Sm,DBbj); 6: end for 7: Fc⟵argmin(Ed); 8:end for 9:Fb⟵removeOutliers(Fc);