Find value from column / row number

1 Ansicht (letzte 30 Tage)
Rifky Pramadya
Rifky Pramadya am 27 Mär. 2018
Kommentiert: Vijay Mohangekar am 19 Mär. 2020
Hi,
I've vector A = [5, 7, 8, 11, 4, 5, 7]
Now, I want to know what is value in column number 3 and 5, hoping with results 11 and 4.
Can you help me get the script
  1 Kommentar
Vijay Mohangekar
Vijay Mohangekar am 19 Mär. 2020
Do you mean >>A(3) and >>A(5) Note: unlike python here indexing starts with 1,2,....

Melden Sie sich an, um zu kommentieren.

Antworten (2)

Star Strider
Star Strider am 27 Mär. 2018
In MATLAB, array indexing uses integers greater than zero, so indices corresponding to your vector elements 11 and 5 would be 4 and 6, respectively.

Bob Thompson
Bob Thompson am 27 Mär. 2018
If all you want to know is the value of a certain part of the matrix just call the index.
A(3)
A(3) = 8
You can call multiple things with indexing, and you can add logic statements to check for certain values as well if you would like.

Kategorien

Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by