Find row and column of specific array.

5 visualizzazioni (ultimi 30 giorni)
armin m
armin m il 28 Nov 2021
Commentato: armin m il 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

Risposta accettata

Image Analyst
Image Analyst il 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 Commenti
Image Analyst
Image Analyst il 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.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Creating and Concatenating Matrices 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!

Translated by