How to write the output of the code to .csv format and save the file
3 次查看(过去 30 天)
显示 更早的评论
place = ivc, val_a = 3.0000, close_a = 3.2806, diff_a = -0.0935, val_b = 3.0000, close_b = 2.8365, diff_b = 0.0545 X = 0.3, Y = -1.5, temp = 40
place = ivc, val_a = 3.0000, close_a = 3.1910, diff_a = -0.0637, val_b = 3.0000, close_b = 2.6977, diff_b = 0.1008 X = 0.3, Y = -1.5, temp = 150
place = ivc, val_a = 3.0000, close_a = 2.5851, diff_a = 0.1383, val_b = 3.0000, close_b = 2.9607, diff_b = 0.0131 X = 0.0, Y = -2.4, temp = 200
This is the output of my code has more than 10000 entries, but only shown 3 lines for reference. now i want it to be in this .csv format as follows
Place, ivc, ivc, ivc
repeated place, t, f, f, f
temperature, 40,150,200
X, 0.3,0.3,0.3
Y, -1.5, -1.5, -2.4
filename :: / folder / filename.csv
t test :: A_B_C: location_gif: 1, t, t, t
% Description
Place: There we enter the place
Repeated place: t - is true, just add f for all the places that you add (since there are 3 places we have 3 times f)
Temperature: is the temperature (in this example -40 150 200)
X and Y as separate variables
filename: add the path of the file
t test :: A_B_C: location_gif: 1, t, t, t,
The number of "t" s corresponding to the number of places.
So how do i write it? and also how do i link the output of the code and save it in .csv format? Kindly help
0 个评论
回答(1 个)
Image Analyst
2020-6-6
Because of all that other stuff you want (place, temperature, etc.) I think it's best if you just use fprintf() to write all that stuff out in your complicated custom format.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Import and Export 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!