I converted double in CSV, but I need the comma at the end of each value
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Anita Coletta
am 28 Okt. 2020
Beantwortet: Star Strider
am 28 Okt. 2020
Hello everybody!
I'm a begginer in Matlab but I need to know how to do somethings for a internship. I need to convert a double to a CSV file; I did it with "writematrix" and it works!
The problem is that I need to put this *.CSV in another software and it wants each value delimited with comma.
I want something like this:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/395303/image.png)
But I have this:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/395308/image.png)
Can someone help me? Thank you
I'll show you a part of the code where are the variables that I need:
%inizializziamo un vettore di soli zeri in cui raccoglieremo i valori in mV da salvare
sign1=zeros(size(P)); %P=P(:,1)
for k=1:length(P)
if P(k)==1
sign1(k)=signdata(k);
end
end
----------
writematrix(sign1,'myFile.CSV','Delimiter',','); %converto matrice in file CSV
0 Kommentare
Akzeptierte Antwort
Star Strider
am 28 Okt. 2020
If it absolutely must have commas, it is straightforward to make it happy:
x = rand(5,1);
fprintf('%.4f,\n', x)
producing (in this random run):
0.7577,
0.7431,
0.3922,
0.6555,
0.1712,
.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Data Import and Export finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!