hi,
i have two matrices, each of size 2xn and 2xm. i would like to select one column from each of these matrices and compare its elements. now even if any one of the elements meet the condition then i would like to exit a while loop. for example-
A=[a11 a12; a21 a22]
B=[b11 b12 b13; b21 b22 b23]
now i want to find the difference the first columns of each of the matrices. meaning (a11 vs b11) and (a21 vs b21). now if any one of these two results is below a certain value then i would like to exit the while loop.

댓글 수: 1

Jan
Jan 2018년 5월 11일
편집: Jan 2018년 5월 11일
"if any one of the elements meet the condition" - which condition? What is "a11, a12, ..."? Are they numbers or objects or symbolic variables?
Do you have 1 or 2 while loops?
"select one column from each of these matrices and compare its elements" - which column? Compare the elements by which operation? greater, greater equal, lower, lower equal, equal, opposite signs, higher absolute value? Please be more specific.

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

 채택된 답변

Jan
Jan 2018년 5월 11일

0 개 추천

Perhaps with some guessing:
A = rand(2, 2);
B = rand(2, 3);
% For the 2nd while loop:
while ???
if any(A(:, 1) - B(:, 1) < Limit)
break;
end
end
I do not have an idea for the 1st part, because it is not clear which column you want to choose and how you want to "compare" the values.

댓글 수: 2

Saira
Saira 2023년 2월 15일
hello sir! i have an array having two column. array holds number of data with their priority 1 to 10(higher value means higher priority ) and know I have to put the data of this array according to their priorities into an another arrays . basicalyy 3 diffrent arrays of different size one array has limit 20 to hold data other has length 30 and the last array has the capacity to hold data is 40. these arrays have some values already in it. these array also have two columns (1st coulmn hold data in its 2nd column shows lru number 1 to 7 of that particular data . now I HAVE to evict the least recently used data having lru<7 and replace it with the data of an element with higher priority one by one using loops.
we can say from one main array we have to get value and then replece it with the others arrays value with less lru number .
main array may contain 1000 number of data with their priority number... basically all arays has same column number but different length.
please help me how to do that . i have done these steps through matlab build in command but I want to use loop because when large ammount of data is arrived then its not possible for me to put data one by one to kindly help me out to do that.
Jan
Jan 2023년 2월 16일
@Saira: Please do not attach a new question as a comment to an answer to another question. Open a new thread instead and romove this message. Thanks.

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

추가 답변 (0개)

카테고리

도움말 센터 및 File Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

질문:

fk
2018년 5월 11일

댓글:

Jan
2023년 2월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by