Substract element of a matrix!

조회 수: 3 (최근 30일)
Francesco
Francesco 2014년 2월 14일
댓글: Matt J 2014년 2월 14일
I have this variable:
>> out1
ans =
Columns 1 through 5
[899x5 double] [899x5 double] [899x5 double] [899x5 double] [899x5 double]
Columns 6 through 10
[899x5 double] [899x5 double] [899x5 double] [899x6 double] [899x6 double]
Columns 11 through 15
[899x6 double] [899x6 double] [899x6 double] [899x6 double] [899x6 double]
Column 16
[899x6 double]
And I want to substract at each columns of the out variable the third element of each [899*5] or [899*6]
  댓글 수: 1
Francesco
Francesco 2014년 2월 14일
I want to substract at each columns of the out1 variable the third element. A sort of this line of code:
bsxfun(@minus, prova,prova(3,:))

댓글을 달려면 로그인하십시오.

채택된 답변

Matt J
Matt J 2014년 2월 14일
편집: Matt J 2014년 2월 14일
cellfun(@(c) bsxfun(@minus, c,c(3,:)) , out1,'uni',0)
  댓글 수: 2
Francesco
Francesco 2014년 2월 14일
This code read the first element of the third rows of the out1 variable and substract each for all the columns?
Matt J
Matt J 2014년 2월 14일
For each matrix out1{i}, it subtracts the 3rd row from all of the other rows.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by