How to remove single quotes
2 次查看(过去 30 天)
显示 更早的评论
Hi, I have below data cell array of mixed data:
'2018-02-01' '22:11:23' '22:12:15' 'Va#VSF04TH00' 'KU' '0' '1.00' '47' 'JKP01'
'2018-02-01' '23:16:23' '22:16:15' 'Va#VSU04TH00' 'UL' '0' '5.00' '47' 'TKP01'
'2018-02-01' '22:20:23' '22:45:12' 'Ja#VSF04TH00' 'PA' '4' '11.00' '87' 'JKP01'
I want to remove ' ', and write to csv file
0 个评论
回答(1 个)
Jan
2018-3-16
The quotes are most likes not included in the data, but inserted only for displaying the data in the command window. Unfortunately you did not post, how you have created the shown output.
Data = {'2018-02-01' '22:11:23' '22:12:15' 'Va#VSF04TH00' 'KU' '0' '1.00' '47' 'JKP01'; ...
'2018-02-01' '23:16:23' '22:16:15' 'Va#VSU04TH00' 'UL' '0' '5.00' '47' 'TKP01'; ...
'2018-02-01' '22:20:23' '22:45:12' 'Ja#VSF04TH00' 'PA' '4' '11.00' '87' 'JKP01'};
fid = fopen(FileName, 'w');
if fid == -1
error('Cannot open file: %s', FileName);
end
DataT = Data.';
fprintf(fid, '%s, %s, %s\n', DataT{:});
fclose(fid);
Does this work?
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!