Trying to go from 1 matrix to a structure with a condition in the next column
Hello, so I have a [1x996] matrix that I am trying to break up to read two different outcomes: for all values less than 1.5, the values are considered critical for all values greater than 1.5, the values are considered not critical Ideally, I want to make a struct with the first column stating the values in the 1x996 matrix and the second column stating if the number from the first column is critical or not critical.
I have tried a variety of for loops and if else statements, but I can't get the values to list them all together in the correct order (if I pull out all of the criticals and all of the not criticals, then they will not be in the right line position for matlab for my other files of code. The picture illustrates what I am trying to do.

This is where I am at:
if true % for i=1:length(LabeledSituations) All_CutIn = (strcmp(LabeledSituations(i).CutIn_Label,'CutIn')); CutIn_files = find(All_CutIn == 1); dx = LabeledSituations(i).Data.Signals(114).Value; dvx = LabeledSituations(i).Data.Signals(116).Value; TTC = dx./dvx; real_TTC = TTC(CutIn_files) %%% i need to make a structure where the first column is the numerical %%% values and the second column is the condition (critical or nc) critical_TTC = real_TTC(real_TTC < 1.5); nc_TTC = real_TTC(real_TTC > 1.5); end ------------------------------------------------------------
0 Comments
Accepted Answer
2 Comments
More Answers (1)
3 Comments
See Also
Categories
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!