Deleting the same empty row in 2 different column vectors - then searching a value giving the other column vector result
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
nayan
am 14 Mär. 2021
Kommentiert: nayan
am 26 Mär. 2021
Quite easy for some more experanced then me, still learning Matlab.
Hoping someone could help.
From the file attached, I am trying to do the following......
- From row DTCs I would like to delete the rows with [ ] and delete the corresponding rows in FlowID
2.Then, lets say I wanted to search for "P22D5-37" in DTCs, I would like the program to give me all the values from FlowID values
0 Kommentare
Akzeptierte Antwort
ANKUR KUMAR
am 14 Mär. 2021
Bearbeitet: ANKUR KUMAR
am 14 Mär. 2021
load_mapping_csv
Mapping_refine=Mapping(~strcmp(Mapping(:,3),'[]'),[1:3]);
The script of load_mapping_csv is attached, and has been prepared using matlab automatic script to load data from csv files: Home > Import Data
If you have only one search query, you can use this
search_query='P22D5-37';
Mapping_refine(contains(Mapping_refine(:,3),search_query),:)
If you have multiple queries, you can use cellfun function to iterate over all cell elements.
One can use Mapping_search_query or Mapping_search_query_merged to see the results from different perspective.
search_queries={'P22D5-37','U0064-88'}
Mapping_search_query=cellfun(@(x) Mapping_refine(contains(Mapping_refine(:,3),x),:), search_queries,'uni',0)
cat(1,Mapping_search_query{:})
14 Kommentare
ANKUR KUMAR
am 22 Mär. 2021
Attached is the script of load_compare_csv.m, which has been Auto-generated by MATLAB.
load_compare_csv
CompareCasevals=cell2mat(CompareCase);
new_unique_vals=unique_vals(cellfun(@length, arrayfun(@(x) find(CompareCasevals==x),unique_vals,'uni',0))~=0)
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!