find average of x and y values separatly of excel file in Matlab.
    3 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Tahir
      
 el 24 de Mayo de 2014
  
    
    
    
    
    Editada: Azzi Abdelmalek
      
      
 el 24 de Mayo de 2014
            Hi, I read an excel file...now i want to one by one take the x values and y values from that excel file.....The x values are at the first column,and y value are in the second column..and similrly again x value at 3rd column and y value at fourth column...i applied two nested loops...but i can not the x and y value...plz help....here is the code
file = xlsread('TrainingDataset\1.csv');
sizeF=size(file);
rows_F=sizeF(1);    % number of rows in file
cols_F=sizeF(2);     %number of column in file
for i=1:rows_F
    xSum=0;
    ySum=0;
    n=0;   
    for j=1:cols_F
          xSum=xSum + file(:,j);  % How to get x values here and y value after this.
          ySum=ySum + file(:,j);
          n=n+1;
      end
% find the averge of x and y values separtly
      divider=n./2;
      centre=zeros(i,2);
      centre(:,1)=xSum ./ divider; 
      centre(:,2)=ySum ./ divider;   
  end
please help
0 comentarios
Respuesta aceptada
  Azzi Abdelmalek
      
      
 el 24 de Mayo de 2014
        
      Editada: Azzi Abdelmalek
      
      
 el 24 de Mayo de 2014
  
      M=randi(10,4,6)
x=M(:,1:2:end)
y=M(:,2:2:end)
average_x=mean(x(:))
average_y=mean(y(:))
0 comentarios
Más respuestas (0)
Ver también
Categorías
				Más información sobre Logical en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

