get the position of each number
    1 visualizzazione (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
Hi, I've got a variable that gives me all the messages that have the value I asked for.

What I want is to get a variable that gives me the position where I can find the number 215382000 the final output would be:
first cell = 5
second cell = 6
third cell = 10
fourth cell = 11
like this. Here I upload the data too
0 Commenti
Risposta accettata
  Jon
      
 il 26 Ott 2021
        Assuming you just want the non-empty cells
idx  = find(~cellfun(@isempty,Msg_mmsi_selected))
2 Commenti
  Jon
      
 il 27 Ott 2021
				I noticed you accepted Cris' answer. His answer works, but I think the approach I have here does the same thing in just one line. That would seem preferable. I'm wondering if there is something that I missed.
Più risposte (1)
  Cris LaPierre
    
      
 il 26 Ott 2021
        Not sure of a single function solution, but this works.
load msg_mmsi_selected
ind = ~cellfun("isempty",Msg_mmsi_selected);
V = 1:length(Msg_mmsi_selected);
c = V(ind)
0 Commenti
Vedere anche
Categorie
				Scopri di più su Annotations 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!


