Dear Matlab Coder,
The idea was to find the index if each of the row fulfill the following condition, such as
Second column of ROW contain the string= Acond Third column of ROW contain the string = SS1 Seventh column of ROW contain the number = 1
Manually inspect, the index that fulfill the following condition are index 4 15 26.
To automated the procedure, the following code is realize. The mat file is attached together in this question
load ('raw.mat')index1 = find((strcmp(raw (:,2), 'ACond') & (strcmp(raw (:,3), 'SS1'))));index2 = find([raw{:,7}] == 1);
As notice in the above line, I had to used two index. I believe this the last two line can be combined to get a compact representation. So, the following code is proposed
load ('raw.mat')index1 = find((strcmp(raw (:,2), 'ACond') & (strcmp(raw (:,3), 'SS1')) & ([raw{:,7}] == 1)));
However, the proposed code is not working as intended. May I know the workaround for this problem?.
To add, may I know a more compact representation if the condition are to be extended, say
index1 = find( (strcmp(raw (:,1), 'Sub3') & (strcmp(raw (:,2), 'ACond') & (strcmp(raw (:,3), 'SS1'))...& ([raw{:,5}] == 4)) & ([raw{:,7}] == 1)));
Thanks in advance for the time entertaining this problem
Best Answer