Can writetable delimit strings using single-quotes?
2 次查看(过去 30 天)
显示 更早的评论
I am using writetable to export to CSV. All strings are delimited with double quotes. Is there any way to have strings delimited by single quotes? The help from "doc writetable" doesn't seem to provide a name-value pair to control this.
0 个评论
采纳的回答
Chunru
2022-4-26
You may not change the quote string with writetable directly.
However, you can add a single quote to your string before writing.
% create a small table
str = ["A", "B", "C D"]';
num = [1 2 3]';
t = table(str, num)
% No quotation marks
writetable(t, 'test.txt')
type test.txt
% double quotation marks
writetable(t, 'test1.txt', 'QuoteStrings', true)
type test1.txt
% single quotation marks
t.str = "'"+t.str+"'";
writetable(t, 'test2.txt')
type test2.txt
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!