フィルターのクリア

How to save 2 column vectors of multiple arrays existing in workspace to a .txt file or in excel file ?

2 ビュー (過去 30 日間)
i got my all labeled arrays in workspace . now i want to store those arrays separately in some .txt file or in excel file .. like label 1's 2's ....max coordinates save in one file ..or it will save in multiple files having no idea about that . Help me

採用された回答

Image Analyst
Image Analyst 2012 年 7 月 22 日
編集済み: Image Analyst 2012 年 7 月 23 日
I don't think you want to save them in a text file or an Excel workbook, based on reading your other posting. I think they should be images also. Use something like this (untested)
[labeledImage numberOfBlobs] = bwlabel(binaryImage, 8); % Label each blob so we can make measurements of it
% Get all the blob properties.
blobMeasurements = regionprops(labeledImage, 'PixelList');
for r = 1 : numberOfBlobs
% Extract blobs one at a time.
% Note how we use ismember() to do this.
oneRegion = ismember(labeledImage, r);
% Save it to disk.
baseFilename = sprintf('Region number %d.png', r);
fullFileName = fullfile(folder, baseFilename);
imwrite(oneRegion , fullFileName);
thesePixels = blobMeasurements(r).PixelList;
% Now use fopen(), fprintf(), and fclose() to write thesePixels to a disk file.
end
  2 件のコメント
sameen
sameen 2012 年 7 月 23 日
sir the above code is giving me this error
??? Error using ==> regionprops Too many output arguments.
and please tell me how to store all those coordinate values in some text or excel file (which is most suitable and easily integrated with c sharp???)
Image Analyst
Image Analyst 2012 年 7 月 23 日
編集済み: Image Analyst 2012 年 7 月 23 日
Sorry - I edited it to fix the mistake. I assume you know how (or can easily figure out how) to use fprintf() to write the coordinates to a file. Comment out the filename and imwrite line if you don't want an image file. Don't use Excel since that will take a long time - much longer than fprintf().

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Import from MATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by