How to check if several variables are not equal ?
18 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(1 个)
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 个评论
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.
- Store your data in a table.
- Filter data based on components.
- Use something like ismember across the result you get in the above step to find the common provider across 3 components.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Type Conversion 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!