find unique array cell with 2 field
조회 수: 7 (최근 30일)
이전 댓글 표시
load('matlab_f.mat')
f
i want to find row equal
f(1.:) and f(2,:) are equal
f(3.:) and f(4,:) are not equal
댓글 수: 0
채택된 답변
추가 답변 (2개)
Sameer
2024년 10월 13일
편집: Sameer
2024년 10월 13일
Hi Luca
To compare rows of a cell array and determine if they are equal, you can use the "isequal" function.
Here's how you can do it:
load('matlab_f.mat')
% Check if the first and second rows are equal
if isequal(f(1,:), f(2,:))
disp('f(1,:) and f(2,:) are equal');
else
disp('f(1,:) and f(2,:) are not equal');
end
% Check if the third and fourth rows are equal
if isequal(f(3,:), f(4,:))
disp('f(3,:) and f(4,:) are equal');
else
disp('f(3,:) and f(4,:) are not equal');
end
Please refer to the below MathWorks documentation link:
Hope this helps!
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!