Indexing based on part of a string
    18 visualizzazioni (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
    Kristine
 il 6 Ott 2025 alle 23:17
  
    
    
    
    
    Commentato: Kristine
 il 7 Ott 2025 alle 0:44
            Hi y'all, 
I want to pull information from a table based on two pieces of information. I want the values in column1 to be 01, and I want the values in column 2 to include the text "2025-02" 
This code did not work: 
No1 = table(table.column1 == 01, table.column2 == '2025-02*');
I can only get a list of the rows if I use the full text found in column2. But I want to find all of the rows where part of the text exists. 
0 Commenti
Risposta accettata
  Paul
      
      
 il 6 Ott 2025 alle 23:23
        column1 = [1;2;1;2;1]; column2 = ["2025-02 A";"A 2025-02";"B";"a 2025-02 a";"b 2025-02 b"];
T = table(column1,column2)
T(T.column1 == 1 & contains(T.column2,"2025-02"),:)
Più risposte (0)
Vedere anche
Categorie
				Scopri di più su Matrix Indexing in Help Center e File Exchange
			
	Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

