convert char to double

41 views (last 30 days)
Farshid Daryabor
Farshid Daryabor on 8 Apr 2020
I really appreciate someone tell me how can I convert attached file to double.
Thanks in advance.

Accepted Answer

Geoff Hayes
Geoff Hayes on 8 Apr 2020
Farshid - try using cellfun. It seems that the pn is a cell array with 38 elements and each element is a 8x1 char array. You haven't mentioned if each of the 8 characters is a single number or if all 8 combine to one (I'll assume the latter).
>> myData = load('example.mat');
>> numericData = cellfun(@(x)str2double(x'), myData.pn);
  8 Comments
Farshid Daryabor
Farshid Daryabor on 9 Apr 2020
Dear Geoff,
I really appreciate, veryyyyygoodddddddddd

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by