How to import variables to excel sheet?

Hi,
I am working on image segmentation and feature extraction. After extracting features like geometric and texture, i get them as variables.
stats,area,perimeter etc. I get around 15 variables where stats is an 12*1 struct and holds 12 values inside it(GLCM). How to import all these values to excel sheet automatically? I need to use excel sheet for image classification further. I use Matlab 2014a. Please help me in this. Thank You.

 Accepted Answer

KSSV
KSSV on 19 Jul 2019
Read about xlswrite

5 Comments

Hello KSSV,
Thanks for your answer. Since i a new to matlab if u can explain how to use it it will be much better.
However i get a error like this...
Undefined function 'write' for input arguments of type 'struct'
All my answers are stored in struct.
Convert strcuture to cell using struct2cell and try. Better would be to attch your data.
As you said the struct2cell is working perfectly and i imported area value of then image to excel. But the real problem starts now. I need to do the same for GLCM values also i.e. for stats variable also in 2 column(it contains 4 values can go up to 10). I need the same for another 30 images to be stored in same excel file.
I am attaching my code and input image.
Variable names might look funny(No offence)..
clc;
clear all;
close all;
a=imread('44.png');
a=rgb2gray(a);
J = imcomplement(a);
figure,
imshow(J)
glcm=graycomatrix(J);
stats=graycoprops(glcm);
b=im2bw(J);
figure,
imshow(b);
C=regionprops(b,'Area')
CC=struct2cell(C);
CCC=struct2cell(stats)
please tell what to do next?
YOu are writitng only numbers to excel?
yes i need only numbers to excel.In the above program we get direct numberical values but sometimes it comes in scientific notation also like 1.005e+01 etc for few features.

Sign in to comment.

More Answers (0)

Products

Release

R2014a

Community Treasure Hunt

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

Start Hunting!