Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write in Matlab please Specific entries in a two dimensional array dataMatrix are identified by a logical index array logicalSelect. Assign the first numSelected of

Write in Matlab please

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

Ex: If dataMatrix is [-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 selectedData = SelectLogicalN( dataMatrix, logicalSelect, numSelected )

% SelectLogicalN: Return the first numSelected values of input 2D

% array dataMatrix indexed by localSelect indexing array.

% Inputs: dataMatrix - input data matrix (2D array)

% logiccalSelect - logical indexing array, can be 2D or linear

% 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

C++ Database Development

Authors: Al Stevens

1st Edition

1558283579, 978-1558283572

More Books

Students also viewed these Databases questions

Question

How do modern Dashboards differ from earlier implementations?

Answered: 1 week ago