finding the value of a corresponding column in matrix

조회 수: 3 (최근 30일)
yas bat
yas bat 2024년 3월 12일
댓글: yas bat 2024년 3월 12일
hello, i have matrix A which consists of two columns. one is the size of the shoe and the second is the model.
how can i find the models that are in a specific size? for example, if the shoe size is 40, i need the models that are in that size.
function A=MatModel()
size1=randi([35,47],25,1);
model=randi([6,13],25,1);
A=[size1,model];
end
function modelvec=ShModel(A,x)
A=MatModel()
size1=MatModel;
x=input('what is your shoe size: ');
for i=1:25
c=find(A==x);
end
size1(size1=c)
end

채택된 답변

Matt J
Matt J 2024년 3월 12일
편집: Matt J 2024년 3월 12일
models = A(A(:,1)==40,2)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Math Operations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by