Find row and column of specific array.

5 vues (au cours des 30 derniers jours)
armin m
armin m le 28 Nov 2021
Commenté : armin m le 29 Nov 2021
Hi. I want to find row and column of array in matrix. But with out using the find function. Because it finds the same numbers and put them in specific matrix. I want the code like this:
C=0
for j=1:10
C=C+1
[Rownum, colnum]=Q(j)
R(C,1)=Rownum
R(C,2)=colnum
end

Réponse acceptée

Image Analyst
Image Analyst le 28 Nov 2021
What is Q?
To get the rows and columns try the meshgrid() function:
x = 1 : 5; % 5 columns.
y = 1 : 4; % 4 rows.
[columnsArray, rowsArray] = meshgrid(x, y)
columnsArray = 4×5
1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5
rowsArray = 4×5
1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4
  24 commentaires
Image Analyst
Image Analyst le 29 Nov 2021
@armin m, I don't know what the going rate is for custom programming in your country is.
"i write" doesn't make too much sense. It would be either
  1. "I am writing" meaning you have already begun and are currently writing for him.
  2. "I wrote" meaning you finished writing and are all done.
  3. "I will write" meaning you have not yet started to write but will write for him in the future.
As you can imagine, the hourly rate varies a lot from country to country. Usually you'll give them a cost estimate before you begin work so you also have to estimate the time it will take you to do the job.
armin m
armin m le 29 Nov 2021
I am writing

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by