Reading particular amount of char in a string
5 views (last 30 days)
Show older comments
Shivani Rani
on 29 Sep 2015
Commented: Star Strider
on 29 Sep 2015
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?
0 Comments
Accepted Answer
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
More Answers (0)
See Also
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!