MATLAB: A Quickie: do I have to create a temp array in the code

functionMATLABmax

Hi,
Q? do I have to create the temp array 'abMt'. Can I rap 'TxTRIn{ii,2}(indx,2:5)' in max to get ans?
1 first I create an index of the section of the array I wish to find max
2 load required data into temp array
3 max(array(:)) returns absolute max for complete data set.
1 indx = (TxTRIn{ii,2}(:,1)>= 800) & (TxTRIn{ii,2}(:,1)<= 1500);
2 abMt = TxTRIn{ii,2}(indx,2:5);
3 abMax = max(abMt(:));
Thanks

Best Answer

It looks as if TxTRIn{ii,2}(indx,2:5) is 2D. If that's correct, you can write
abMax = max(max(TxTRIn{ii,2}(indx,2:5)));
to avoid the temporary array. However, the way you have it now is probably clearer to read, and I doubt that it is any less efficient.