Read from and make new based on positions
    6 visualizzazioni (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
    Nicle Davidson
 il 16 Ott 2021
  
    
    
    
    
    Commentato: Nicle Davidson
 il 16 Ott 2021
            I would like to go through a matrix which looks like this:

the numbers stand for ascii values
where there is capital letter means a word ends.
I read this matrix from a file, 
Then I would like to make a new matrix where I register where in this matrix I have the capital words.
So far I know to read from a matrix I would need a for loop such as:
for i=size(S)
    %here I would like to make a new matrxi based on the positons of the
    %capital words in S matrix
    if S(i,j)>=65 || S(i,j)<=90
        % here M would form
    end
end
but what I actually would like to make out of the S, which is the matrix read from the file and shown above, 
is to make a new matrix, say M, which has registerted where I have capital letters in S. 
Then M will look like 
M=(4    5
      5    7
      5   10
      2    12)
because for example  S(4,5) has 87 which stands for the capital letter W.
Questions in background to think about could be:
how can I read from S and make M? 
How can I find the positions and use them making a new matrix. If it helps the attached file contains the matrix.
0 Commenti
Risposta accettata
  Ive J
      
 il 16 Ott 2021
        Why not this?
G = [0	115	0	0	0	0	0	0	0	0	111	0	0
0	0	110	0	0	0	110	0	0	0	0	82	0
0	0	0	111	0	0	0	111	0	0	0	0	0
0	0	0	0	87	114	0	0	114	0	0	0	0
0	0	0	0	0	0	84	0	0	84	0	0	0
0	0	0	0	0	0	0	0	0	0	0	0	0
0	0	0	0	0	0	0	0	0	0	0	0	0
0	0	0	0	0	0	0	0	0	0	0	0	0
0	0	0	0	0	0	0	0	0	0	0	0	0
0	0	0	0	0	0	0	0	0	0	0	0	0
0	0	0	0	0	0	0	0	0	0	0	0	0
0	0	0	0	0	0	0	0	0	0	0	0	0
0	0	0	0	0	0	0	0	0	0	0	0	0];
idx = G >= 65 & G <= 90;
[r, c] = find(idx);
M = [r, c]
Più risposte (0)
Vedere anche
Categorie
				Scopri di più su Multirate Signal Processing 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!

