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

2 ビュー (過去 30 日間)
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 件のコメント
madhan ravi
madhan ravi 2019 年 3 月 6 日
please explicitly state your desired result
Sonia Goyal
Sonia Goyal 2019 年 3 月 8 日
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.

サインインしてコメントする。

回答 (1 件)

KSSV
KSSV 2019 年 3 月 6 日
A = rand(3,4) ;
iwant = A(1,3)-A(:)
  1 件のコメント
Sonia Goyal
Sonia Goyal 2019 年 3 月 8 日
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.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by