Is there a way to crop an array depending on the values that I want through a function as the values change?
I currently have a graph that has multiple flat maxima but I only want the index values of the last one. I am currently using islocalmax(data,’flatselection’,’all’) to get all of the local maxima that exist and that then gives me a logical array which I can then either get the index values of all the 1’s but I then want the last collection of 1’s or the last collection of consecutive indexes. I was just wondering if there was a way to specifically select these values? I could manually find the start point of the last set and then set it to the end but as I want to use it on multiple data sets I want it to be automatic.
peaks = islocalmax(test.CAN_EMTrq,’FlatSelection’,’all’);
peaks1 = find(peaks==1);
This is the code I am using right now.
The table either looks like: 000011111000100001111101111 and I want the last 4 1’s or it looks like: 12,13,14,15,34,35,36,37,38,56,57,58,59 and I want the last 4 numbers.
ThanksI currently have a graph that has multiple flat maxima but I only want the index values of the last one. I am currently using islocalmax(data,’flatselection’,’all’) to get all of the local maxima that exist and that then gives me a logical array which I can then either get the index values of all the 1’s but I then want the last collection of 1’s or the last collection of consecutive indexes. I was just wondering if there was a way to specifically select these values? I could manually find the start point of the last set and then set it to the end but as I want to use it on multiple data sets I want it to be automatic.
peaks = islocalmax(test.CAN_EMTrq,’FlatSelection’,’all’);
peaks1 = find(peaks==1);
This is the code I am using right now.
The table either looks like: 000011111000100001111101111 and I want the last 4 1’s or it looks like: 12,13,14,15,34,35,36,37,38,56,57,58,59 and I want the last 4 numbers.
Thanks I currently have a graph that has multiple flat maxima but I only want the index values of the last one. I am currently using islocalmax(data,’flatselection’,’all’) to get all of the local maxima that exist and that then gives me a logical array which I can then either get the index values of all the 1’s but I then want the last collection of 1’s or the last collection of consecutive indexes. I was just wondering if there was a way to specifically select these values? I could manually find the start point of the last set and then set it to the end but as I want to use it on multiple data sets I want it to be automatic.
peaks = islocalmax(test.CAN_EMTrq,’FlatSelection’,’all’);
peaks1 = find(peaks==1);
This is the code I am using right now.
The table either looks like: 000011111000100001111101111 and I want the last 4 1’s or it looks like: 12,13,14,15,34,35,36,37,38,56,57,58,59 and I want the last 4 numbers.
Thanks matlab, data MATLAB Answers — New Questions