Extract rows according to the rows sum

1 回表示 (過去 30 日間)
shane cannon
shane cannon 2017 年 7 月 30 日
編集済み: MSP 2017 年 7 月 30 日
Hi I have a matrix (A) and I want to extract certain rows that sum to 15. I want to display those rows in another matrix (B). This is my code so far it does not work, please help.
A = nchoosek(1:9,3);
if sum(A,2)==15
disp(B)
end
Thanks.

採用された回答

MSP
MSP 2017 年 7 月 30 日
編集済み: MSP 2017 年 7 月 30 日
clear all
close all
A = nchoosek(1:9,3)
x=find(sum(A,2)==15)
B=A(x,:)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMultirate Signal Processing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by