How to calculate the difference b/w elements of a matrix corresponding to any one element of a m*n matrix using loop

2 visualizaciones (últimos 30 días)
hello,
I want to calculate the difference b/w different elements of a matrix corresponging to any single element.
say, i am having any 3*4 matrix and want to calculate the difference from element [1 3] with each and every remaining lemnents of the of the matrix.
  2 comentarios
Sonia Goyal
Sonia Goyal el 8 de Mzo. de 2019
say this is the matrix A = [ a b c d; f g h i; j k l m ]
and if i want to calculate the difference from element a11 with respect to each and every remaining element of the matrix using a loop because i will have to do the same for a matrix with larger dimensions.

Iniciar sesión para comentar.

Respuestas (1)

KSSV
KSSV el 6 de Mzo. de 2019
A = rand(3,4) ;
iwant = A(1,3)-A(:)
  1 comentario
Sonia Goyal
Sonia Goyal el 8 de Mzo. de 2019
Thank you for kind response sir but i have the different query.
say this is the matrix A = [ a b c d; f g h i; j k l m ]
and if i want to calculate the difference from element a11 with respect to each and every remaining element of the matrix using a loop because i will have to do the same for a matrix with larger dimensions.

Iniciar sesión para comentar.

Categorías

Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by