trouble turning a 1x1 cell into a double
Show older comments
I'm trying to read a series of files into an array and ensure the data from Current_Coil_1_A is read in and converted to a double. Here's my csv file format:
"Coil Flux-Linkage: Wb <Time, s:0, Step: 1>"
"","Value"
"Current_Coil_1_B","0.0400143721601"
"Current_Coil_1_A","0.0400142095048"
I want "0.0400142095048" turned into a double of precision 3 or so. So I cycle through the number of cases:
for n = 1:cases
currentCSVFile = fopen('filename' num2str(n) '.csv');
fgetl(currentCSVFile) %reads line but does nothing with it
fgetl(currentCSVFile)
fgetl(currentCSVFile)
temp = textscan(currentCSVFile, '%*q%q%*q', 'Delimiter',',');
DataArray(1,n) = str2double(temp);
end
DataArray will then appear as NaN even though I think temp should be a valid argument. Any help would be appreciated.
Accepted Answer
More Answers (0)
Categories
Find more on Data Type Conversion in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!