Question: matlab Specific entries in a two dimensional array dataMatrix are identified by a logical index array logicalSelect . Assign the first numSelected of the selected

matlab Specific entries in a two dimensional array dataMatrix are identified by a logical index array logicalSelect. Assign the first numSelected of the selected elements to an array selectedData.
Ex: If dataMatrix is 1-2,3,6: 5,78,44: 9,-3,-53], logicalSelect is [1,0,0: 0,0,1: 1,1,1], and numSelected is 4, then selectedData is [-2.
9: -3: 44].
Function e
E Save C Reset EE MATLAB Documentation
function selectedData - SelectLogicalN( dataMatrix, logicalSelect, numSelected )
%
SelectLogicaiN: Return the first numSelected values of input 20 array dataMatrix indexed by localselect indexing array.
Inputs: dataMatrix - input data matrix (2D array)
logicalSelect - logical indexing array, can be 2D on Linean numSelected - number of indexed elements to return in selectedData
OutputS
SelectedData - column vector of logically indexed elements to return
% Assign tempselected with logically indexed elements of dataMatrix tempSelected - dataMatrix;
% Assign
selectedData with first numselected elements of tempselected
selectedData = dataMatrix;
end

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!