csvwrite increment file name

1 view (last 30 days)
Rusmaya Luthfina
Rusmaya Luthfina on 7 Nov 2011
hi everyone,
i have problem with this code
clear all;
f = 'F:/Maya/pengenalan pola/tugas image retrieve/image';
fileList = dir(fullfile(f,'*.jpg'));
path_save = 'F:/Maya/pengenalan pola/tugas image retrieve/data pixel';
for i = 1:length(fileList)
I{i} = imread((fullfile(f,fileList(i).name)));
out{i} = mat2cell(I{i}, ones(120/60,1)*60, ones(120/60,1)*60, 3);
[ra{i} rb{i} rc{i}] = cellfun(@(x) unique(x(:,:,1)), out{i} , 'un', 0);
[ga{i} gb{i} gc{i}] = cellfun(@(x) unique(x(:,:,2)), out{i} , 'un', 0);
[ba{i} bb{i} bc{i}] = cellfun(@(x) unique(x(:,:,3)), out{i} , 'un', 0);
rr = csvwrite(['r' num2str(i) '.txt'],rc{i});
gg = csvwrite(['g' num2str(i) '.txt'],gc{i});
bb = csvwrite(['b' num2str(i) '.txt'],bc{i});
end
returns error
??? Error using ==> csvwrite Too many output arguments.
Error in ==> histogram at 22 rr = csvwrite(['r' num2str(i) '.txt'],rc{i});
how can i fix this?? really need ur helps, plzzz :(
Maya

Answers (1)

Walter Roberson
Walter Roberson on 7 Nov 2011
<http://www.mathworks.com/help/techdoc/ref/csvwrite.html csvwrite>() does not output anything. What output value were you expecting that you would store in rr, gg, or bb ?
  2 Comments
Rusmaya Luthfina
Rusmaya Luthfina on 8 Nov 2011
rr, gg, bb would be a double array..
thx u Mr. Roberson
--Maya--
Walter Roberson
Walter Roberson on 8 Nov 2011
What double array are you expecting in each case? csvwrite() writes out data, so if it did return anything at all, the sorts of thing it would return might be error codes or counts of the items written or something similar.
If you are expecting that rr and so on would be assigned the data written, then do not try to assign them the output of csvwrite(): just assign rr = rc{i}; gg = gc{i}; bb = bc{i};

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!