.mat file to csv.

조회 수: 3 (최근 30일)
Chidiebere Ike
Chidiebere Ike 2018년 5월 14일
댓글: sloppydisk 2018년 5월 14일
I have a mat file named (bag.mat) with value 1*1 bagOfFeature on my workspace. I want to write it into csv files. I have tried csvwrite function but i got the error:
c = load('bag.mat'); %On my workspace, c has a value of 1*1 struct csvwrite('file.csv', c);
Error using csvwrite (line 47)
Undefined function 'real' for input arguments of type 'struct'.
Attaching my mat file.
I will appreciate your assistance.
Thanks you
  댓글 수: 1
sloppydisk
sloppydisk 2018년 5월 14일
csvwrite only takes matrices as input, bagOfFeatures is a struct. You should specify what you want your output to look like. You could for example extract some parameters from the struct like this:
csvwrite('mybagdata.csv', [bag.VocabularySize; bag.GridStep'; BlockWidth']);
Or you could use fprintf to write headers too.

댓글을 달려면 로그인하십시오.

답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by