csvwrite increment file name

1 次查看(过去 30 天)
Rusmaya Luthfina
Rusmaya Luthfina 2011-11-7
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

回答(1 个)

Walter Roberson
Walter Roberson 2011-11-7
<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 个评论
Rusmaya Luthfina
Rusmaya Luthfina 2011-11-8
rr, gg, bb would be a double array..
thx u Mr. Roberson
--Maya--
Walter Roberson
Walter Roberson 2011-11-8
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};

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by