# MATLAB Tutorial, processing an Excel file in MATLAB16

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 16

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 16

@Vallisha,

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

Doug

vallisha replied on : 3 of 16

Thanks a lot.
Used this :

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

Chen replied on : 4 of 16

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 16

Take a look at xlswrite.

Mohammed Qahwaji replied on : 6 of 16

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 16

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 16

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

Stuart McGarrity replied on : 9 of 16

>>sum(numData(:,1)) would give you the sum of column 1
>>sum(numData) would give you the sum of all columns.

Deepak replied on : 10 of 16

Hello,

I want to write particular column of an excel sheet with some values (1), the excel sheet already has some values in 20 rows and 6 columns, but at the end of the program i want to add value 1 in 7th column for given 20 rows. Will anyone help me out.

Krupali Katakiya replied on : 12 of 16

hello sir,
i have made a datasheet using text format for a matlab program.and now i want to call a specific data from that list(datasheet).how can i do that? can you help me?

Stuart McGarrity replied on : 13 of 16

Hi Krupali, To confirm, is your data stored in an Excel file (e.g. .xlsx)? What MATLAB function did you use to store it? What does your data look like (i.e. # rows, column, data types, headers)? What version of MATLAB do you have? What have you tried to import the data so far?

Kajal replied on : 14 of 16

Hello sir,
I want all programs run at a time in just 1 click and also it read all programs , database which I want to execute . Can u tell me what I do for that . Is there is any code for linking all programs database or any further process . Please send me as early as possible. I am waiting for that .
Thank u…

Stuart McGarrity replied on : 15 of 16

Hi Kajal, Are you saying you have multiple MATLAB programs that you want to run at the same time?

Nauman replied on : 16 of 16

Hi,
How can I find average of an etntire column in excel file using MatLab.

Thanks

What is 8 + 9?

Preview: hide