Replacing string by start of this string
    4 visualizzazioni (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
    Radoslav Vandzura
 il 30 Gen 2016
  
    
    
    
    
    Modificato: Radoslav Vandzura
 il 31 Gen 2016
            Hello All,
would you be so kind, could you advise me, how can i create condition with 'if', when i need replace all columns start with 'something-some string' by other string. For example, I have CPU type:'AMD Opteron 852 Single Core' and I need to replace it by only 'AMD Opteron'....:) Thank you for your help in advance...:)
0 Commenti
Risposta accettata
  per isakson
      
      
 il 30 Gen 2016
        Hint:
cac = {'AMD','INTEL','ZILOG'
       'ZILOG','AMD','INTEL' };
cac = regexprep( cac, '^Z.+$', 'Z80' )
outputs
cac = 
    'AMD'    'INTEL'    'Z80'  
    'Z80'    'AMD'      'INTEL'
All strings starting with "Z" are replaced by "Z80"
7 Commenti
  per isakson
      
      
 il 30 Gen 2016
				
      Modificato: per isakson
      
      
 il 30 Gen 2016
  
			- "start with 'something-some string'"   Why "start", your column contains the full names - or what did I miss ?
- Where do you have the "more simple name" ?
- Where do you want to put the new column ?
- I need more context to help.
Più risposte (0)
Vedere anche
Categorie
				Scopri di più su MATLAB Report Generator in Help Center e File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


