Reading particular amount of char in a string

5 views (last 30 days)
Hello, I am facing some in following this code:
num = ' .10995E+032078.00176';
size(num);
num1 = num(1:11); %num1 = .10995E+03
num2 = num(12:21); %num2 = 2078.00176
num_w = str2num([num1 num2])
I am getting
num_w =
Inf 0.0018
Would you please tell me how can I rectify that problem?

Accepted Answer

Star Strider
Star Strider on 29 Sep 2015
Try this:
num = '.10995E+032078.00176';
num1 = str2num(num(1:11));
num2 = str2num(num(12:end));
num_w = [num1 num2]
  6 Comments
Shivani Rani
Shivani Rani on 29 Sep 2015
Thank you very much. I really appreciate your help

Sign in to comment.

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!