Reputation: 17
I am having difficulty converting data I am taking from a spectrum analyzer. It is being placed in a variable that need to be pushed to an excel file to be usable. The variable that it is placed in is of type char.
a=('-2.2748E+01,-2.3454E+00,5.2434E00,.........')
How do I convert this to usable data?
Upvotes: 0
Views: 54
Reputation: 65460
You can use textscan
to easily parse this string out into multiple numbers.
a = '-2.2748E+01,-2.3454E+00,5.2434E00';
data = textscan(a, '%f', 'delimiter', ',');
data = data{1};
% -22.7480
% -2.3454
% 5.2434
Upvotes: 1