# MATLAB Tutorial, processing an Excel file in MATLAB8

Posted by Doug Hull,

It is very common to read through all the values in an Excel spreadsheet to process them in MATLAB. Here is a simple example of importing Excel in MATLAB and looping through the values.

vallisha replied on : 1 of 8

Hello Sir,

Suppose I have the pixel value, how to find the corresponding pixel position in image ?

Ex: If the pixel value is 160, i want to get the positions of the pixels in the image for which the value is 160.

Doug replied on : 2 of 8

@Vallisha,

This is more of a matrix indexing question. You can use FIND to do that.

Doug

vallisha replied on : 3 of 8

Thanks a lot.
Used this :

index = find(img(:)== 160)

Chen replied on : 4 of 8

Hi,

I can write cells to Excel if numbers are specifid.
I can write simple matrices to excel.

But, is it possible to write something like this to excel:

a=[1 2; 3 4 ; 5 6]
d={‘Temp’, Time; a}
xlswrite(‘ExcelNmae’, d);

Thanks,

Chen

Doug replied on : 5 of 8

Take a look at xlswrite.

Mohammed Qahwaji replied on : 6 of 8

If I have an excel sheet that have only numbers on it. And I want to find how much some values repeated.( like how many times there is number 6 in the excel sheet?) how can I find these values by matlab?

Doug replied on : 7 of 8

First I would import into MATLAB with XLSREAD. Once you have a matrix in, like

a = [11 22 33 22 22]

nnz(a == 22)

will do what you want for 22.

Abby replied on : 8 of 8

hello,
How can you find the total amount of the column from the excel spreadsheet, by using a formula in Matlab?

What is 1 + 2?

Preview: hide

These postings are the author's and don't necessarily represent the opinions of MathWorks.