How to filter a datasheet?
Afficher commentaires plus anciens
I have imported a datasheet from excel in the form of table (130 * 23).
Each column represents a design parameter of robotic actuator (i.e. Continuous Torque, Speed, weight, Reduction ratio, etc.)
I want to filter my table based on some constraints like, I want to extract only those rows where torque value is between 1 to 5 and weight value is between 0 to 1 and so on.
For that I wrote this:
FinalTable = compileddatasheet((compileddatasheet.ContinuousTorqueNm > 1) & (compileddatasheet.ContinuousTorqueNm < 5) & (compileddatasheet.Weightkg > 0) & (compileddatasheet.Weightkg < 1), :);
This code works fine.
But,
Now I want to add one more constraint, see the code below
FinalTable = compileddatasheet(a*(compileddatasheet.ContinuousTorqueNm > 1) & b*(compileddatasheet.ContinuousTorqueNm < 5) & c*(compileddatasheet.Weightkg > 0) & d*(compileddatasheet.Weightkg < 1), :);
As you can see in the above code i added 4 binary variables (a,b,c,d) which can be either 0 or 1.
I added these variables so I can decide whether I want to use the particular constraint or not based on its value (i.e. if a = 0 and other variables are still 1, results will be shown based on only three constraints).
So my approach here is wrong because its not showing the true results.
So it would be of great help if anyone could help me out here with a proper approach.
Thank you.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Choose and Parameterize Blocks dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!