Sorting file from CSV

5 ビュー (過去 30 日間)
sai krishnan
sai krishnan 2018 年 4 月 17 日
回答済み: Bob Thompson 2018 年 4 月 17 日
I want to sort a set of images whose data is given in .csv format.
The data consists of three different types in three columns, by indicating 1 for the specific type and 0 if not.
I want to separate it the whole set of images into three folders using the given .csv data.
Please help.
  2 件のコメント
Bob Thompson
Bob Thompson 2018 年 4 月 17 日
I'm a little confused on what you are asking for. Does each column independently represent an image, and you want to separate the columns into unique files? Or does the data contain three columns and a certain number of rows and you want to separate the data by those rows?
sai krishnan
sai krishnan 2018 年 4 月 17 日
The data contains four columns in total, where the first is the file name rest three and three different classes which I want them to classify it into.
In each of the column of the classes it is either a 1 or a 0 corresponding to the file name.
I hope this gives a little more clarity now.

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

回答 (1 件)

Bob Thompson
Bob Thompson 2018 年 4 月 17 日

Ok, so you're trying to collect a set of file names?

I would suggest organizing using indexing then.

A = % Data block here
B = A(A(:,2)==1,1); % Select file names (column 1) which corresponds to 1's
                    & in column 2.
C = A(A(:,3)==1,1); % 1's in column 3
D = A(A(:,4)==1,1); % 1's in column 4

カテゴリ

Help Center および File ExchangeShifting and Sorting Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by