Reputation: 303
I'm trying to write integer data into CSV file in every iteration, this is my code and I've got this error message
Error: using dlmwrite (line 112) Invalid attribute tag:1
My code:
clc;
clear;
close all;
predictedNumber = 2;
for dataCounter = 1:3000
for dataPredictionCounter = 1:200
dlmwrite('finalResults.csv',predictedNumber,'-append',dataCounter,dataPredictionCounter);
end
end
dataCounter and dataPredictionCounter are row and column numbers.
Upvotes: 1
Views: 544
Reputation: 652
You are using dlmwrite
incorrectly. You have to remove dataCounter
and dataPredictionCounter
because those aren't arguments to dmlwrite. This will be very slow. You can put everything into an array first and then write the array to the file with csvwrite
.
M = rand(50,2);
csvwrite('myFile.txt',M)
Upvotes: 2