how do i join cell array strings for plotting
    6 visualizzazioni (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
hi,
i have a 2 by 3 cell array. the rows looks like: 
{["abc\_111"]}  {["def\_111"]}  {["ghi\_111"]}
{["abc\_123"]}  {["abc\_456"]}  {["abc\_789"]}
what i think i want to do is join all the elements in each row into a column so that i can use them in making a plot with set(gca, 'xticklabels',joined_string).  i think the new joined_sting should look like this
{["abc\_111\_def\_111\_ghi\_111"]}
{["abc\_123\_abc\_456\_abc\_789"]}
i'm both not sure if this is the right way to do this or how to do this.  i've tried join and i keep gettign error messages
1 Commento
Risposta accettata
  Jan
      
      
 il 1 Feb 2023
        
      Modificato: Jan
      
      
 il 1 Feb 2023
  
      Dicide to use a better input format. Either a cell string:
C = {'abc\_111', 'def\_111', 'ghi\_111'; ...
     'abc\_123', 'abc\_456', 'abc\_789'};
Or a string array:
S = ["abc\_111", "def\_111", "ghi\_111"; ...
     "abc\_123", "abc\_456", "abc\_789"];
Then:
result = join(C, '\_', 2)
% or
result = join(S, '\_', 2)
0 Commenti
Più risposte (0)
Vedere anche
Categorie
				Scopri di più su String 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!

