fileID has a limit?
5 views (last 30 days)
Show older comments
Rodrigo Lima
on 8 Jun 2015
Commented: Rodrigo Lima
on 8 Jun 2015
I'm trying to generate txt files from combinations, using the nchoosek command. I have generated 2047 combinations, but when I try to write the combinations on a txt file, only 196 files are generated and then the error "??? Error using ==> fprintf Invalid file identifier. Use fopen to generate a valid file identifier." is triggered. Can anyone help me? Here is a piece of code.
for line=1:num_comb %num_comb = total of combinations
str = sprintf('combinacao%d.txt',line); % name of the txt file changing on every combination
for column=1:n
if matriz(line,column) ~= 0 %matrix 'matriz' has a combination in each line
fid=fopen(str,'a');
for rl=1:count_size(matriz(line,column))+1
fprintf(fid,'%s \r\n',matriz_field{matriz(line,colmun),rl}); %matrix 'matriz_field' has the information to be written using as index the content of 'matriz' matrix
end
fclose=(fid);
end
end
end
0 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Low-Level File I/O in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!