f



Statistics in Matlab from excel worksheet

Hi, 

I have an excel sheet with sediment data ~1500 rows, each row is comprised of various data such as station id, lat, long, particle diameter etc. There are about 75 different stations and about 20 samples from each station.  I am looking to calculate the average diameter in matlab of each station based on it's station id #.  Thanks for the help.
0
Chris
5/28/2010 2:31:20 PM
comp.soft-sys.matlab 211266 articles. 14 followers. lunamoonmoon (258) is leader. Post Follow

9 Replies
456 Views

Similar Articles

[PageSpeed] 39

"Chris " <chris.veinot@hotmail.com> wrote in message <htok3o$7a5$1@fred.mathworks.com>...
> Hi, 
> 
> I have an excel sheet with sediment data ~1500 rows, each row is comprised of various data such as station id, lat, long, particle diameter etc. There are about 75 different stations and about 20 samples from each station.  I am looking to calculate the average diameter in matlab of each station based on it's station id #.  Thanks for the help.

Hi Chris, have you read the data into Matlab using xlsread? It should be a simple matter of calculating the mean at that point.

Wayne
0
Wayne
5/28/2010 2:39:24 PM
"Wayne King" <wmkingty@gmail.com> wrote in message <htokis$7k4$1@fred.mathworks.com>...
> "Chris " <chris.veinot@hotmail.com> wrote in message <htok3o$7a5$1@fred.mathworks.com>...
> > Hi, 
> > 
> > I have an excel sheet with sediment data ~1500 rows, each row is comprised of various data such as station id, lat, long, particle diameter etc. There are about 75 different stations and about 20 samples from each station.  I am looking to calculate the average diameter in matlab of each station based on it's station id #.  Thanks for the help.
> 
> Hi Chris, have you read the data into Matlab using xlsread? It should be a simple matter of calculating the mean at that point.
> 

I'm fairly new to Matlab, but yes I can read the spreadsheet, I'm just not sure how to read specific colums and rows.
> Wayne
0
Chris
5/28/2010 2:47:08 PM
"Chris " <chris.veinot@hotmail.com> wrote in message <htol1c$6ht$1@fred.mathworks.com>...
> "Wayne King" <wmkingty@gmail.com> wrote in message <htokis$7k4$1@fred.mathworks.com>...
> > "Chris " <chris.veinot@hotmail.com> wrote in message <htok3o$7a5$1@fred.mathworks.com>...
> > > Hi, 
> > > 
> > > I have an excel sheet with sediment data ~1500 rows, each row is comprised of various data such as station id, lat, long, particle diameter etc. There are about 75 different stations and about 20 samples from each station.  I am looking to calculate the average diameter in matlab of each station based on it's station id #.  Thanks for the help.
> > 
> > Hi Chris, have you read the data into Matlab using xlsread? It should be a simple matter of calculating the mean at that point.
> > 
> 
> I'm fairly new to Matlab, but yes I can read the spreadsheet, I'm just not sure how to read specific colums and rows.
> > Wayne

I'm not sure I understand your data structure. When you say:
 "> I have an excel sheet with sediment data ~1500 rows, each row is comprised of various data such as station id, lat, long, particle diameter etc."
Are you saying that each row is one kind of data, e.g. station id, or in each row do you have multiple measurements of different data, e.g. station id, lat, long, etc.

You can also do File -> Import Data  and Matlab will basically walk you through importing the data, including creating a variable based on a row or column header.

Wayne
0
Wayne
5/28/2010 2:59:26 PM
"Chris " <chris.veinot@hotmail.com> wrote in message <htol1c$6ht$1@fred.mathworks.com>...
> "Wayne King" <wmkingty@gmail.com> wrote in message <htokis$7k4$1@fred.mathworks.com>...
> > "Chris " <chris.veinot@hotmail.com> wrote in message <htok3o$7a5$1@fred.mathworks.com>...
> > > Hi, 
> > > 
> > > I have an excel sheet with sediment data ~1500 rows, each row is comprised of various data such as station id, lat, long, particle diameter etc. There are about 75 different stations and about 20 samples from each station.  I am looking to calculate the average diameter in matlab of each station based on it's station id #.  Thanks for the help.
> > 
> > Hi Chris, have you read the data into Matlab using xlsread? It should be a simple matter of calculating the mean at that point.
> > 
> 
> I'm fairly new to Matlab, but yes I can read the spreadsheet, I'm just not sure how to read specific colums and rows.
> > Wayne

a hint:

     help xlsread;     % <- now, peruse the example section...

us
0
us
5/28/2010 3:01:06 PM
"Wayne King" <wmkingty@gmail.com> wrote in message <htoloe$luj$1@fred.mathworks.com>...
> "Chris " <chris.veinot@hotmail.com> wrote in message <htol1c$6ht$1@fred.mathworks.com>...
> > "Wayne King" <wmkingty@gmail.com> wrote in message <htokis$7k4$1@fred.mathworks.com>...
> > > "Chris " <chris.veinot@hotmail.com> wrote in message <htok3o$7a5$1@fred.mathworks.com>...
> > > > Hi, 
> > > > 
> > > > I have an excel sheet with sediment data ~1500 rows, each row is comprised of various data such as station id, lat, long, particle diameter etc. There are about 75 different stations and about 20 samples from each station.  I am looking to calculate the average diameter in matlab of each station based on it's station id #.  Thanks for the help.
> > > 
> > > Hi Chris, have you read the data into Matlab using xlsread? It should be a simple matter of calculating the mean at that point.
> > > 
> > 
> > I'm fairly new to Matlab, but yes I can read the spreadsheet, I'm just not sure how to read specific colums and rows.
> > > Wayne
> 
> I'm not sure I understand your data structure. When you say:
>  "> I have an excel sheet with sediment data ~1500 rows, each row is comprised of various data such as station id, lat, long, particle diameter etc."
> Are you saying that each row is one kind of data, e.g. station id, or in each row do you have multiple measurements of different data, e.g. station id, lat, long, etc.
> 
> You can also do File -> Import Data  and Matlab will basically walk you through importing the data, including creating a variable based on a row or column header.
> 
> Wayne

Each row is comprised of colums that have the headers station id lat long etc... so i have multiple measurements of data in each row
0
Chris
5/28/2010 3:14:22 PM
"Wayne King" <wmkingty@gmail.com> wrote in message <htoloe$luj$1@fred.mathworks.com>...
> "Chris " <chris.veinot@hotmail.com> wrote in message <htol1c$6ht$1@fred.mathworks.com>...
> > "Wayne King" <wmkingty@gmail.com> wrote in message <htokis$7k4$1@fred.mathworks.com>...
> > > "Chris " <chris.veinot@hotmail.com> wrote in message <htok3o$7a5$1@fred.mathworks.com>...
> > > > Hi, 
> > > > 
> > > > I have an excel sheet with sediment data ~1500 rows, each row is comprised of various data such as station id, lat, long, particle diameter etc. There are about 75 different stations and about 20 samples from each station.  I am looking to calculate the average diameter in matlab of each station based on it's station id #.  Thanks for the help.
> > > 
> > > Hi Chris, have you read the data into Matlab using xlsread? It should be a simple matter of calculating the mean at that point.
> > > 
> > 
> > I'm fairly new to Matlab, but yes I can read the spreadsheet, I'm just not sure how to read specific colums and rows.
> > > Wayne
> 
> I'm not sure I understand your data structure. When you say:
>  "> I have an excel sheet with sediment data ~1500 rows, each row is comprised of various data such as station id, lat, long, particle diameter etc."
> Are you saying that each row is one kind of data, e.g. station id, or in each row do you have multiple measurements of different data, e.g. station id, lat, long, etc.
> 
> You can also do File -> Import Data  and Matlab will basically walk you through importing the data, including creating a variable based on a row or column header.
> 
> Wayne

Each Row is comprised of data such as station id, lat, long, mean etc.. so each row contains multiple measurements of data
0
Chris
5/28/2010 3:21:30 PM
On May 29, 3:21=A0am, "Chris " <chris.vei...@hotmail.com> wrote:
> "Wayne King" <wmkin...@gmail.com> wrote in message <htoloe$lu...@fred.mat=
hworks.com>...
> > "Chris " <chris.vei...@hotmail.com> wrote in message <htol1c$6h...@fred=
..mathworks.com>...
> > > "Wayne King" <wmkin...@gmail.com> wrote in message <htokis$7k...@fred=
..mathworks.com>...
> > > > "Chris " <chris.vei...@hotmail.com> wrote in message <htok3o$7a...@=
fred.mathworks.com>...
> > > > > Hi,
>
> > > > > I have an excel sheet with sediment data ~1500 rows, each row is =
comprised of various data such as station id, lat, long, particle diameter =
etc. There are about 75 different stations and about 20 samples from each s=
tation. =A0I am looking to calculate the average diameter in matlab of each=
 station based on it's station id #. =A0Thanks for the help.
>
> > > > Hi Chris, have you read the data into Matlab using xlsread? It shou=
ld be a simple matter of calculating the mean at that point.
>
> > > I'm fairly new to Matlab, but yes I can read the spreadsheet, I'm jus=
t not sure how to read specific colums and rows.
> > > > Wayne
>
> > I'm not sure I understand your data structure. When you say:
> > =A0"> I have an excel sheet with sediment data ~1500 rows, each row is =
comprised of various data such as station id, lat, long, particle diameter =
etc."
> > Are you saying that each row is one kind of data, e.g. station id, or i=
n each row do you have multiple measurements of different data, e.g. statio=
n id, lat, long, etc.
>
> > You can also do File -> Import Data =A0and Matlab will basically walk y=
ou through importing the data, including creating a variable based on a row=
 or column header.
>
> > Wayne
>
> Each Row is comprised of data such as station id, lat, long, mean etc.. s=
o each row contains multiple measurements of data

You say you know all about xlsread, so what's the problem?
a=3Dxlsread(xslfile);
Now, if your sediment size is in column 6, then guess what?
Matlab will have cleverly put it into column 6 in a.
So to get the mean, you would say mean(a(:,6))
0
TideMan
5/28/2010 9:32:22 PM
TideMan <mulgor@gmail.com> wrote in message <4dd7b08d-b4af-49c2-be12-f26b9b3ece20@42g2000prb.googlegroups.com>...
> On May 29, 3:21 am, "Chris " <chris.vei...@hotmail.com> wrote:
> > "Wayne King" <wmkin...@gmail.com> wrote in message <htoloe$lu...@fred.mathworks.com>...
> > > "Chris " <chris.vei...@hotmail.com> wrote in message <htol1c$6h...@fred.mathworks.com>...
> > > > "Wayne King" <wmkin...@gmail.com> wrote in message <htokis$7k...@fred.mathworks.com>...
> > > > > "Chris " <chris.vei...@hotmail.com> wrote in message <htok3o$7a...@fred.mathworks.com>...
> > > > > > Hi,
> >
> > > > > > I have an excel sheet with sediment data ~1500 rows, each row is comprised of various data such as station id, lat, long, particle diameter etc. There are about 75 different stations and about 20 samples from each station.  I am looking to calculate the average diameter in matlab of each station based on it's station id #.  Thanks for the help.
> >
> > > > > Hi Chris, have you read the data into Matlab using xlsread? It should be a simple matter of calculating the mean at that point.
> >
> > > > I'm fairly new to Matlab, but yes I can read the spreadsheet, I'm just not sure how to read specific colums and rows.
> > > > > Wayne
> >
> > > I'm not sure I understand your data structure. When you say:
> > >  "> I have an excel sheet with sediment data ~1500 rows, each row is comprised of various data such as station id, lat, long, particle diameter etc."
> > > Are you saying that each row is one kind of data, e.g. station id, or in each row do you have multiple measurements of different data, e.g. station id, lat, long, etc.
> >
> > > You can also do File -> Import Data  and Matlab will basically walk you through importing the data, including creating a variable based on a row or column header.
> >
> > > Wayne
> >
> > Each Row is comprised of data such as station id, lat, long, mean etc.. so each row contains multiple measurements of data
> 
> You say you know all about xlsread, so what's the problem?
> a=xlsread(xslfile);
> Now, if your sediment size is in column 6, then guess what?
> Matlab will have cleverly put it into column 6 in a.
> So to get the mean, you would say mean(a(:,6))

Okay thanks, what I'm having trouble with though is figuring out how to take select data within the sheet and calculate the mean.  I'm not looking to take the mean of all of the data but just of a single ID number which is only about 20 rows in a 1500 row work sheet.  I need to do this for ~75 different ID numbers.
0
Chris
5/31/2010 11:34:04 AM
"Chris " <chris.veinot@hotmail.com> wrote in message <hu06rc$k70$1@fred.mathworks.com>...
> TideMan <mulgor@gmail.com> wrote in message <4dd7b08d-b4af-49c2-be12-f26b9b3ece20@42g2000prb.googlegroups.com>...
> > On May 29, 3:21 am, "Chris " <chris.vei...@hotmail.com> wrote:
> > > "Wayne King" <wmkin...@gmail.com> wrote in message <htoloe$lu...@fred.mathworks.com>...
> > > > "Chris " <chris.vei...@hotmail.com> wrote in message <htol1c$6h...@fred.mathworks.com>...
> > > > > "Wayne King" <wmkin...@gmail.com> wrote in message <htokis$7k...@fred.mathworks.com>...
> > > > > > "Chris " <chris.vei...@hotmail.com> wrote in message <htok3o$7a...@fred.mathworks.com>...
> > > > > > > Hi,
> > >
> > > > > > > I have an excel sheet with sediment data ~1500 rows, each row is comprised of various data such as station id, lat, long, particle diameter etc. There are about 75 different stations and about 20 samples from each station.  I am looking to calculate the average diameter in matlab of each station based on it's station id #.  Thanks for the help.
> > >
> > > > > > Hi Chris, have you read the data into Matlab using xlsread? It should be a simple matter of calculating the mean at that point.
> > >
> > > > > I'm fairly new to Matlab, but yes I can read the spreadsheet, I'm just not sure how to read specific colums and rows.
> > > > > > Wayne
> > >
> > > > I'm not sure I understand your data structure. When you say:
> > > >  "> I have an excel sheet with sediment data ~1500 rows, each row is comprised of various data such as station id, lat, long, particle diameter etc."
> > > > Are you saying that each row is one kind of data, e.g. station id, or in each row do you have multiple measurements of different data, e.g. station id, lat, long, etc.
> > >
> > > > You can also do File -> Import Data  and Matlab will basically walk you through importing the data, including creating a variable based on a row or column header.
> > >
> > > > Wayne
> > >
> > > Each Row is comprised of data such as station id, lat, long, mean etc.. so each row contains multiple measurements of data
> > 
> > You say you know all about xlsread, so what's the problem?
> > a=xlsread(xslfile);
> > Now, if your sediment size is in column 6, then guess what?
> > Matlab will have cleverly put it into column 6 in a.
> > So to get the mean, you would say mean(a(:,6))
> 
> Okay thanks, what I'm having trouble with though is figuring out how to take select data within the sheet and calculate the mean.  I'm not looking to take the mean of all of the data but just of a single ID number which is only about 20 rows in a 1500 row work sheet.  I need to do this for ~75 different ID numbers.

well...
why not expand tm's solution and add a row-limit(?)...

     rb=10;
     re=30;
     nc=6;
     r=mean(a(rb:re,nc);

us
0
us
5/31/2010 11:39:04 AM
Reply:

Similar Artilces:

Move an Excel Worksheet to another Excel Workbook with Matlab
I need to move an Excel Worksheet to a different Workbook with matlab. I am currently able to create an Excel worksheet and add data to the required cells. I want to be able to move this Worksheet to a different workbook. When I try the code, >> invoke(Activesheet.Move,'Resutls.xls') it creates a new workbook and moves the worksheet to the newly created workbook instead of 'Resutls.xls'. It also gives the error ??? One or more output arguments not assigned during call to "Move". Does anyone have any ideas? Thanks, Jared <http://www.420megs.com/users/e...

Matlab and Excel worksheets
Hi guys, I have a small query regarding Excel worksheets. I have a spreadsheet with around 20 worksheets in it. Do any of you know of the easiest way to import it into Matlab? I have tried using xlsread and Import data tab from the menu, but it still doesn't work. Would be of great help. Thanks. Rahul On Dec 19, 3:35 am, "Rahul Srivatsa" <rahul.nospample...@nomail.com> wrote: > Hi guys, > > I have a small query regarding Excel worksheets. I have a > spreadsheet with around 20 worksheets in it. Do any of you > know of the easiest way to import it into...

Run Matlab ... from Matlab
Hello, Is there any limitation to run Matlab from Matlab, as a system command, on Linux platforms ? I tried to start Matlab, both using the ! syntax (!matlab&) or the system command (system('matlab&')), the Matlab splash screen appears, but the new Matlab session closes rapidly . When I do the same with a script of mine (system('matlab -r "myscript"&')), my script is being executed, but Matlab finally crashes . If I remove the &, it works well, but the first Matlab session is blocked till I close the second one . I run Matlab on a Linux 64bits pla...

MATLAB talking to MATLAB?
For my project, I need to have a client program (MATLAB executable) talking to a server program (also MATLAB executable) to query data. Is there any easy way to accomplish that? I appreciate any help that I can get on that. Thanks. Cheers, Hoi Oops, I forgot to mention. There are multiple clients querying the server, so I guess serial objects + remote serial port wouldn't work. "Hoi Wong" <wonghoi.ee@gmail.com_> wrote in message news:f3ald6$gg4$1@news.Stanford.EDU... > For my project, I need to have a client program (MATLAB executable) > talking to a ser...

How do you hide a Worksheet in Excel using Matlab?
In Matlab, I am creating an Excel File with multiple worksheets in it. However, I would like to hide one of those worksheets so that it is not visible to the user after I save it. I do not want to delete the worksheet because I need that worksheet to run some Macros in it. How can I do this? Thanks for your time, Brad Brad G. wrote: > > > In Matlab, I am creating an Excel File with multiple worksheets in > it. However, I would like to hide one of those worksheets so that > it > is not visible to the user after I save it. I do not want to > delete > the worksheet be...

writing MATLAB images into Excel worksheets
Does anyone have a method to write an image from MATLAB into Excel worksheets? The Shapes.AddPicture command isn't working for me. My application is to pull images from a number of separate directories and compile them into a single document with images from each test group on a separate worksheet. Thanks in advance for any pointers! Cindy On Tue, 06 Oct 2009 19:14:02 -0400, Cynthia <remove.this.cynthia.bell@asu.edu> wrote: > Does anyone have a method to write an image from MATLAB into Excel > worksheets? The Shapes.AddPicture command isn't working for me. My ...

Excel error 429 when running Matlab magic square example from Matlab builder
Hi, I was working with the Matlab builder magic square example (can be found in matlab builder users guide) in Matlab to compile and build m-files into COM objects for Excel. Essentially, the building process creates a .bas file which can be imported into Visual Basic Editor in MS Excel. In the VB code, the Matlab functions essentially end up being wrapped up inside COM objects and you can invoke these functions in the excel spreadsheet. The example works successfully for output to a single cell. For outputing to multiple cells simultaneously, the code changes a little as a macros are in...

Deleting non-empty Excel Worksheet through MATLAB
Hi, I am trying to delete some worksheets in an Excel workbook. These excel worksheets have data as well as some pictures. I just want to delete the non-empty excel sheets before running a long code. These sheets have data from the previous execution of the same MATLAB programme. I looked at several messages posted on the web, but none of them discuss about deleting non-empty worksheets. I would be grateful if you can help. I am using actxserver for accessing the Excel application. Many thanks in advance, Dilbag ...

How to embed a matlab code behind an excel worksheet?
I want to write a matlab code that will work behind excel. Basically, the users will enter input to an excel sheet, click a button on the secreen and this will trigger a matlab code that comes with the excel sheet. The code will run and give the output on an excel sheet. The users don't necessarily have matlab. They should be able to run the code though. Is there a quick and easy way to combine my matlab code with an excel sheet? thanks, onur. ps. I am familiar with vbasic. However, I prefer to include a matlab code since it runs faster with vectors. "Onur" <onuruncu@yah...

Statistics with matlab
Hi! I'm going to use matlab for doing some statistical analysis. In particular I will work in the framework of the bayesian statistics. Does anyone know if there are any good books (also directly connected with some matlab examples) that can help me? (also .pdf files if they are detailed). PS: I don't have the statistical toolbox! "Pool " <pool.ruggeri@gmail.com> wrote in message news:imv543$7k4$1@fred.mathworks.com... > Hi! > > I'm going to use matlab for doing some statistical analysis. In particular > I will work in the framework of the bayesia...

Spawning matlab from within matlab
Hello all, I would like to spawn multiple matlab processes from an '.m' script. Meaning, run an m-file from a 'parent' Matlab that launches, say, 8 more 'children' matlab processes. I'd like to do it in such a way that the same m-file in the 'parent' is able to close down, or kill, all the 'children' processes. Any suggestions? Joe ...

Matlab plots outside Matlab
I'm making an end-user application where I would like to use Matlab functionality both for calculation and plotting. Matlabs GUI builder guide does not satisfy my needs (no support for f.ex. internal frames and other nescessities), so I'm planning to compile my Matlab code and use other API (Java, QT or something) for GUI. My problem is then, that I loose access to the neat plotting commands availible under matlab GUI... Is there a way of integrating Matlabs plot functionality into another GUI system? - has it been done? - I appreciate any response! - P�l Berge ...

Calling Compiled MATLAB from MATLAB
Hello everyone, How do I compile MATLAB M files into a form that can then be called from within the MATLAB interpreter? A roundabout way would seem to be to (somehow) Turn the matlab code into C (I think mcc does this), then compile this C code into MEX format and call that. Is there an easier way? I have the MATLAB compiler, so I just need to know what to do with it to get this to work. Thanks in advance, Sina sina.tootoonian wrote: > > > Hello everyone, > > How do I compile MATLAB M files into a form that can then be called > from within the MATLAB interpreter? A round...

matlab to matlab remote execution
Hi I have two win PCs running matlab 7. One is slow and other is a high spec fast PC. They are connected to LAN. The directory on fast PC where all matlab work takes place has been mounted as a drive on slow PC. Hence this directory on fast PC can be accessed from slow PC's matlab session. I want to let the user on slow PC run some computationally intense M scripts in his matlab session but execute them on fast PC. I tried usual unix like method. First installed telnet server on fast PC. Then used telnet client on slow PC to log on fast PC. If I attempt to start matlab in slow PC telnet ...

Web resources about - Statistics in Matlab from excel worksheet - comp.soft-sys.matlab

Statistics - Wikipedia, the free encyclopedia
More probability density is found as one gets closer to the expected (mean) value in a normal distribution . Statistics used in standardized ...

Statistics - Wikipedia, the free encyclopedia
More probability density is found as one gets closer to the expected (mean) value in a normal distribution . Statistics used in standardized ...

Statistics - Wikipedia, the free encyclopedia
More probability density is found as one gets closer to the expected (mean) value in a normal distribution . Statistics used in standardized ...

Statistics - Wikipedia, the free encyclopedia
Statistics Jump to: navigation , search Page statistics Content pages 3,956,211 Pages (All pages in the wiki, including talk pages, redirects, ...

Cleveland Cavaliers' LeBron James unfazed by gruesome NBA shooting statistics
Now that he's 31, a multimillionaire and a business mogul, LeBron James joked how people don't know what to get him for his birthday. So James ...

WA police commissioner Karl O'Callaghan defends police as crime statistics rise
... police commissioner Karl O'Callaghan has defended the state's crime-fighting model amid calls from the opposition to scrap it. Statistics ... ...


Thomas Jefferson School Of Law To Stand Trial For Allegedly Inflating Employment Statistics
Never before has a law school been forced to actually stand trial for allegedly inflating its employment statistics. This is historic.

Statistics: Android users were all about phablets this holiday season
... course, these handsets are nearly extinct, so we are still left in the dark. Medium Android phones follow phablets as the second highest statistic, ...

Patriots Weren't Crazy, Statistics Defend Choice to Kick in Overtime - Bleacher Report
Hindsight can be a bully. Back in 2002, Detroit Lions head coach Marty Mornhinweg famously opted to kick off to start overtime in a game against ...

Resources last updated: 1/29/2016 11:31:01 PM