How to delete/copy (store) rows of a struct?
    22 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Peter Meier
 el 27 de Jul. de 2020
  
    
    
    
    
    Respondida: Stijn Haenen
      
 el 27 de Jul. de 2020
            Hello,
One simply question: How can i delete rows of a struct? For example 1*45 struct the last 13 rows? Or how can i copy/store somewhere else the last 13 rows?
Thank you so much.
0 comentarios
Respuesta aceptada
  Arthur Roué
      
 el 27 de Jul. de 2020
        You can do as a regular array :
myStruct; % 1x45 strcu-array
% Split index
k = numel(myStruct) - 13;
% Slice structure
myStruct(1:k)       % first elements before k
myStruct((k+1):end); % last element, from k to end
0 comentarios
Más respuestas (1)
  Stijn Haenen
      
 el 27 de Jul. de 2020
        You can delete the last 13 rows with:
struc.data=[1:45]';
struc.data(end-12:end)=[];
0 comentarios
Ver también
Categorías
				Más información sobre Structures 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!


