Can you remove certain characters from first column and each row of a table?
8 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Mihai Ciortuz
il 24 Giu 2019
Modificato: Mihai Ciortuz
il 25 Giu 2019
I have this table:
files aMean
_____________________________ __________________
'C:\Users\dexte\OneDrive\Desktop\1' 3.38904290625e-10
'C:\Users\dexte\OneDrive\Desktop\2' 3.727809984375e-12
'C:\Users\dexte\OneDrive\Desktop\3' 4.03381559375e-10
'C:\Users\dexte\OneDrive\Desktop\4' 3.550222328125e-10
'C:\Users\dexte\OneDrive\Desktop\5' 3.75777240625e-10
'C:\Users\dexte\OneDrive\Desktop\6' 4.319917984375e-12
'C:\Users\dexte\OneDrive\Desktop\7' 4.1586619375e-10
I would like to have 1, 2 ,3, 4 in the first column instead of getting the whole filepath. Any help?
0 Commenti
Risposta accettata
Image Analyst
il 25 Giu 2019
In a loop, get the filename and extract the last character(s) that are the number or use fileparts. Untested code:
for k = 1 : size(t, 1)
thisFileName = t.files{k}
[folder, number, ext] = fileparts(thisFileName)
t.files{k} = number;
end
That's untested so it might need some tweaking. Attach your table in a .mat file if you need more help.
1 Commento
Più risposte (0)
Vedere anche
Categorie
Scopri di più su String Parsing 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!