Issue with importing excel files
Show older comments
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'))
Accepted Answer
More Answers (0)
Categories
Find more on Characters and Strings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!