Filtering for variable amount of constraints
Afficher commentaires plus anciens
Hi Everyone,
I have the following problem: I want to filter a dataset for a number of constraints. However, this number of constraints is variable.
I have the follwing code:
%% Filter for cargo constraints
%Solution 1
Data.VCsuit = Data.VC(strcmp(Data.Cargotypes{3,1},Data.VC{:,6})==1 | strcmp(Data.Cargotypes{2,1},Data.VC{:,6})==1,:);
%Solution 2
for i = 1 : height(Data.Cargotypes)
Data.VCsuit = Data.VC(strcmp(Data.Cargotypes{i,1},Data.VC{:,6})==1,:);
end
the problem with solution 1 is the variable, the problem of solution 2 is that it overwrites the previous filter. All datasets are tables. How can I best approach this? The dataset is in the attachements.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Images 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!