Write a function with the header:
function [out] = myDataTypeChecker(A,B)
takes two matrices A and B and has the following behavior (in this order):
1) if either A or B contains a “Not a Number”, the function should return -1.
2) if either A or B contains an +/-Infinity, the function should return -2
3) if either A or B is a character array, the function should return -3
4) if both A and B are logical arrays, the function should check to see if A and B
are the same size.
If they are not, it should return -4
If they are, it should return the AND of A and B (an array indicating where
both A and B are true)
5) if both A and B are numeric arrays, the function should check to see if A and B
are the same size.
If they are not, it should return -5
If they are, it should return an array of the absolute value of the difference
of A and B.
6) If A and B are not both logical arrays or not both numeric arrays,, it should return
-6;
function [ out ] = myDataTypeChecker( A,B )
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
lenA = length(A);
lenB = length(B);
for i=1:1:lenA
if(isnan(A(i)))
out = -1;
return
end
end
for i=1:1:lenB
if(isnan(B(i)))
out = -1;
return
end
end
for i=1:1:lenA
if(isinf(A(i)))
out = -2;
return
end
end
for i=1:1:lenB
if(isinf(B(i)))
out = -2;
return
end
end
if(ischar(A) || ischar(B))
out = [-3];
return
end
if(islogical(A) && islogical(B))
if(length(A) == length(B))
out = and(A,B);
return
else
out = -4;
return
end
elseif(isnumeric(A) && isnumeric(B))
if(length(A) == length(B))
out = abs(A-B);
return
else
out = -5;
return
end
end
out = -6;
end
The matlab function is provided for the requirement specified.
Please like,
:-)
Thank you for your support.
Write a function with the header: function [out] = myDataTypeChecker(A,B) takes two matrices A and B...
MATLAB Write a function maxContent(arr) that takes a cell array arr as input and returns the longest string and largest number in arr. If there are two character arrays of same length, the function should return one of them. Assume that integers in the cell array are nonnegative.
Write a C function that takes two strings (character arrays) as input and return 1 if they are equal and return 0 if they re not. Two arrays are considered equal if both arrays contain the same number of elements, and all corresponding pairs of elements in the two arrays are equal in the same order.
Write a C function that takes two strings (character arrays) as input and return 1 if they are equal and return 0 if they re not. Two arrays are considered equal if both arrays contain the same number of elements, and all corresponding pairs of elements in the two arrays are equal in the same order.
Language C Code Write a program that takes two integer arrays (A and B) and sums them together (element wise). A third array to accept the result should be passed in as the output argument. Assume the arrays are all the same size. The argument N is the size of the arrays. Your code should provide a function with the following signature: void array Addition (int A[], int B[], int N, int output[]) { } Your code must also provide...
Write a mips program that defines two integer array that are pre-sorted and the same size (e.g., [3, 7, 9, 11, 15, 21] and [1, 4, 6, 14, 18, 19]) and a function merge that takes the two arrays (and their size) as inputs and populates a single array of twice the size of either input array that contains the elements of both arrays in ascending order. In the example arrays given, then output would be [1, 3, 4, 6,...
Write a method that takes two arrays of integers and return and array that is the union of both arrays. For instance, the first array contains (1,2,3), the second array(4,5,6), the returned array should contain (1,2,3,4,5,6) (3.5 points) Write a method that takes and an array and return the reverse of that array. For instance, if the array is (1,2,3), the returned array should be (3,2,1) (3.5 points)
C++ Programming 1. Write a function (header and body) that accepts an integer as an argument and returns that number squared. 2. Write the code that will fill an integer array named multiples with 10 integers from 5 to 50 that are multiples of five. (This should NOT be in the form of an initialization statement.) 3. Write the code that will display the contents of the integer array named multiples. Recall: the size of the array is 10. 4....
Write a function to add two one-dimensional matrices of integer values. The matrices are represented as arrays of int and the function must return the result as a pointer to a new dynamically allocated array of int. You can assume the parameters are always of length greater than 0 and that no errors can occur.
C++
Write a program to calculate the sum of two matrices that are
stored inside two-dimensional arrays. Your program should include
three functions: one for getting input data, one for calculating
the sum of matrices, and one for printing the result.
a) Function inputMatrix: This Function prompts the user to enter
the data and stores data inside two-dimensional array.
b) Function addMatrices: This function calculatesthe sum result
of two matrices.
c) Function printMatrix: This function prints the matrix to
screen....
Question 2 In this question, you will read two data files that
include integers into two different arrays – the same way we did in
class (but we are doing to arrays here). Duplicates are ok. 1-
After you read the data into the array (use one function that takes
an int array and a dsize by reference just like we did in class,
and call that from main to fill both arrays). 2- Include a
printArray function so that...