Issue with importing excel files
Mostra commenti meno recenti
I posted a question similar to this, but I did not realize what was really going on until recently.
My excel file has multiple rows of the following form.
f 27//1 29//2 5//3 2//4
For this line, it is separated into 5 cells, which I will indicate with | signs.
f | 27//1 | 29//2 | 5//3 | 2//4
When I want to call the cell with 27//1 in it, i put..
txt(1,2)
and it gives me the following.
'27//1'
I need to extract the number to the left of the // sign. The problem is, I believe the single quotation marks from the import are messing things up. When I actually TYPE in 27//1 in the regexp function it works.
str2double(regexp('27//1','\d+(?=//)','match'))
However when I call the cell in the regexp it does NOT. I get NaN
str2double(regexp(txt(1,2),'\d+(?=//)','match'))
How can I circumvent this? I tried to search for a number between a ' and a // sign, but it didn't work.
str2double(regexp(txt(1,2),'(?<=")\d+(?=//)','match'))
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Characters and Strings in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!