how to ds mapping
显示 更早的评论
Hi, basically i'm trying to write a code to compare the values that i have on a table with a certain range and give it a value
if Accel >= 0.28 & Accel < 2.1 this is equal to number 1
if Accel >= 2.11 & Accel < 3.63 is equal to number 2
and then with both values use it to create a map.
回答(1 个)
Anushka
2025-1-29
To effectively compare values in your table with specified ranges and assign corresponding values, you can leverage MATLAB's logical indexing capabilities.Here are the steps you can follow to acheive this:
- If your data is in a table, you can load it using the 'readtable' function or create it manually. For a better understanding of the 'readtable' function, you can refer to the following documentation: https://www.mathworks.com/help/matlab/ref/readtable.html
- Once the data is loaded, apply logical conditions to compare the 'Accel' values against your specified ranges. Here is a snippet of code for better understanding:
data.AccelValue(data.Accel >= 0.28 & data.Accel < 2.1) = 1;
data.AccelValue(data.Accel >= 2.11 & data.Accel < 3.63) = 2;
- Use the values to create a map. For MATLAB R2022b and previous releases, you can refer to the following documetation: https://www.mathworks.com/help//releases/R2022b/matlab/matlab_prog/overview-of-the-map-data-structure.html
I hope this explanation helps you implement your solution smoothly.
类别
在 帮助中心 和 File Exchange 中查找有关 Geodesy and Mapping 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!