Loading a .csv file that contains units
14 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hey guys. I need to load multiple .csv files into my code where I am interested in the data of one column (the dBm value). However, the numbers there also have units, not seperated by a comma. Is there a way to get rid of the units, or load the numbers without them? Thank you very much in advance!
0 Kommentare
Antworten (2)
Star Strider
am 17 Jun. 2022
Try something like this —
opts = detectImportOptions('CSV File Test 2022 06 17.txt');
opts = setvartype(opts, 'Var4','double');
opts = setvaropts(opts, 'Var4','Suffixes','dBm');
T1 = readtable('CSV File Test 2022 06 17.txt', opts)
Here, ‘Var1’ is a duration array, ‘Var2’ and ‘Var3’ are character arrays, and ‘Var4’ is set as a double array. Setting its suffix to 'dBm' removes the suffix, leaving a double value. See Remove Prefix or Suffix Characters From Variables (it took me a while to find it).
I created ‘SV File Test 2022 06 17.txt’ to test this.
.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!