How to check if several variables are not equal ?

조회 수: 15 (최근 30일)
Dalia Sobhy
Dalia Sobhy 2017년 12월 13일
댓글: KL 2017년 12월 13일
Hello How to check if several variables are not equal ? for example:
for i=1:row1
for j=1:row1
for k=1:row1
for ii=1:row1
for jj=1:row1
for kk=1:row1
So I want to check that they are all not equal, in case they are different do the following:... so any help how to do this ?
Thanks

답변 (1개)

KL
KL 2017년 12월 13일
편집: KL 2017년 12월 13일
use isequal. It checks all the inputs are equal and if yes, it returns 1. Use ~ if you want only the else case.
if isequal(var1,var2,var3,...)
...
else
...
But so many for loops, explain your real problem, it may have a simpler approach.
  댓글 수: 2
Dalia Sobhy
Dalia Sobhy 2017년 12월 13일
Okay will try it.
I am trying to get data from wsdream dataset which is a web services dataset.
Given that I have 140 service providers, where each may provide some components from a set of 4500 components. So How to find 6 providers which provide the same 3 components ?
Thanks
KL
KL 2017년 12월 13일
Quite vague and I can only give you some hints rather than creating some dummy data to show you an example.
  1. Store your data in a table.
  2. Filter data based on components.
  3. Use something like ismember across the result you get in the above step to find the common provider across 3 components.

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

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by