read specific data from excel and create a vector ?
    7 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    MUKESH KUMAR
 el 31 de Jul. de 2017
  
    
    
    
    
    Editada: MUKESH KUMAR
 el 31 de Jul. de 2017
            I have attached excel file
and to create a row vector 1*24 like
A1=[0 0 0 0 2.2 2.2 2.2 2.2 2.2 2.2 2.2 2.2 2.2 2.2 2.2 0 0 0 0 0 0 0 0 0];
A2=[0 0 0 0 0 0 0 0 0 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5 0 0 0 0];
0 comentarios
Respuesta aceptada
  KSSV
      
      
 el 31 de Jul. de 2017
        
      Editada: KSSV
      
      
 el 31 de Jul. de 2017
  
      [num,txt,raw] = xlsread('app.xls') ;
A1 = zeros(1,24) ;
A1(num(1,2):num(1,3)) = num(1,1) ;
A2 = zeros(1,24) ;
A2(num(2,2):num(2,3)) = num(2,1) ;
2 comentarios
  Walter Roberson
      
      
 el 31 de Jul. de 2017
				The
clc; clear al ;
do not appear to be doing any useful work there ?
Más respuestas (1)
  Walter Roberson
      
      
 el 31 de Jul. de 2017
        (This code is not tested)
[num, txt] = xlsread('app.xls');
nrow = size(num, 1);
use_cell = cell(nrow, 2);
for K = 1 : nrow
  this_entry = zeros(1,24);
  this_entry( num(K,2) : num(K,3)) = num(K,1);
  use_cell{K,1} = txt{K,1};
  use_cell{K,2} = this_entry;
end
use_struct = cell2struct(use_cell(:,1), use_cell(:,2));
Now there will be use_struct.a1 and use_struct.a2
0 comentarios
Ver también
Categorías
				Más información sobre Data Import from MATLAB 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!


