I am trying to write data to a file where the first column is the time values and the second column is the volts values.
4 次查看(过去 30 天)
显示 更早的评论
When I run my code instead of the all the time values going in one column and all the volts going in the other, it creates a matrix with two columns but fills both columns with time values until it reaches the end then starts to fill in volts.
%store data in a file called scaledLigo
data= [new_t_array2;scaled_volts];
fileID = fopen('scaledLigo.txt','w');
fprintf(fileID,'%6.8f %12.8f\n',data);
fclose(fileID);
0 个评论
采纳的回答
Jon
2021-12-1
I think the problem is tha fprintf writes the elements columnwise. You could send the transpose (use the ' operator)
fprintf(fileID,'%6.8f %12.8f\n',data');
and I think you will get what you want
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Workspace Variables and MAT-Files 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!