Borrar filtros
Borrar filtros

is it possible to save csv files in loop with fopen..getting error Error using fopen Invalid permission.

2 visualizaciones (últimos 30 días)
for k=1:38
Column_1_t=(1:1000)*0.00008
Column_2_output = cellstr(num2str(Y{k}.OutputData));
mag = Y{k}.OutputData;
% change name here to write
% change name here to write
savedfile = folder_name;
fid_out(k) = fopen(num2str(k),'savedfile_.csv','w'); %open file and create fid %here i am getting error
%save tab-separated column headers
%define column format and names and save to file
fprintf(fid_out(k),'%s%s%s\n','time',',','Cal');
fprintf(fid_out(k),'%s%s%s\n','(ms)',',','(V)');
fprintf(fid_out(k),'\n');
%save tab-separated columns of data
for i = 1:size(data,1) %loop trough each line of each data variable and save to file line by line
%define column format and date to be saved.
%use () for numeric data, and {} for strings
fprintf(fid_out(k),'%0.8f%s%0.8f\n',data(i,1),',',data(i,2));
end
fclose(fid_out(k))
end

Respuesta aceptada

Star Strider
Star Strider el 2 de Nov. de 2019
It would be easier to use csvwrite (or writematrix) than creating you own version.
  4 comentarios

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Data Import and Analysis en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by