function [I,J] = myFind(M,key)
[row cols] = size(M);
I = [];
J = [];
B = ones(cols,row);
for i = 1:row
for j = 1:cols
if(M(i,j)==key)
I = [I; i];
J = [J; j];
end
end
end
end
M = [10 0 -5;3.14,10, 74.6;10,2,7];
[I,J] = myFind(M,2)
[I,J] = myFind(M,10)
=================================================================
SEE OUTPUT
Thanks, PLEASE COMMENT if there is any concern.
This problem is of moderate complexity and illustrates how a flow chart can be useful in making a working code. Write...
The second problem, the one I'm asking about, is only making changes to the first problem, which I have included the correct code for. Thank you!! een be modeled by diding the plate io adiscrese grid of cels and sulting the change in tenspentureof ell over 90 2.2 3) dared es dlebel css (saggestion:use5 both ves w fint, ut increme this 1o 20asee you get yeur pragranı warking. Your progrars shcald do the Sllasing lain the cs alus of the...
cope the code please thanks Write a MATLAB code to obtain the following. Keep your code commented whenever required. Copy your source code and command widow outcomes and screen shots of any plots in your solution. Generate a matrix "A" as follow. A= 16 6 8 2 10 18 12 14 4 I. II. Divide the matrix A by 2 and store the result in a matrix B. Combine matrices A & B to obtain the following matrix C. Also...
6. From the following flow-chart, write the java code. false a<100 print Done true print Bad a++ 7. Given an array int[] myarray = {2, 4, 6, 8, 9, 7, 5, 3, 1, 0} Create a trace table for variables involved in the following code int s = 10; for (int i = 3; i <7; i++) S = S + myarray[i]; What is the final value of s? 8. Given an ArrayList object mywords of the content Avengers Endgame...
How can I write this code (posted below) using vectors instead of arrays? This is the task I have and the code below is for Task 1.3: Generate twenty random permutations of the number 0, 1, 2, ..., 9 using of the algorithms you designed for Task 1.3. Store these permutations into a vector and print them to the screen with the additional information of unchanged positions and number of calls torand(). Calculate the total numbers of unchanged positions. Compare...
Please solve only if you know how to do it. Write the code using C++ (not Python or Java). Show and explain everything neatly. COMMENTS (7.5% of programming assignment grade): Your program should have at least ten (10) different detailed comments explaining the different parts of your program. Each individual comment should be, at a minimum, a sentence explaining a particular part of your code. You should make each comment as detailed as necessary to fully explain your code. You...
Hi there I need help coming up with the C code for this problem. At the beginning of the program and before each function use comments to explain what the function does. Do not use global variables 1. The Pascal triangle can be used to compute the coefficients of the terms in the expansion of atb In a Pascal triangle, each element is the sum of the element directly above it and the element to the left of the element...
Please do in C please. Edit sliding.c. Comments on code would be nice. Thank you. Here is main.c #include "sliding.h" #include <malloc.h> #include <stdlib.h> //Prints grid in row major order. Tries to ensure even spacing. void print_grid(int * my_array, int rows, int cols){ int i,j; for(i=0; i<rows; i++){ for(j=0; j<cols; j++){ if(my_array[i*cols + j]!=-1){ printf(" %d ", my_array[i*cols + j]); } else{ printf("%d ", my_array[i*cols + j]); } } printf("\n"); } } int main(int argc, char *argv[]) { int seed,rows,cols;...
I need help fixing this code and adding a loop please. Here is the original problem: #include <iostream> using namespace std; //function to print seating chart void printSeatingChart(int **chart) { int i, j; cout << "\nROW\t"; for (i = 1; i <= 10; i++) { cout << i << "\t"; } cout << "\n-----------------------------------------------------------------------------------\n"; for (i = 8; i >= 0; i--) { cout << "\n" << i + 1 << "\t"; for (j = 0; j < 10; j++) ...
P7.5– A theater seating chart is implemented as a two-dimensional array of ticket prices, like this: 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 20 20 20 20 20 20 10 10 10 10 20 20 20 20 20 20 10 10 10 10 20 20 20 20 20 20 10 10 20 20 30 30...
Help due in a few hours I need to clean this up can you help me clean up this code to accomplish the same task but with fewer lines/ more elegantly. Thank you! My code for the function is below: int is_valid_board(int board[9][9]) { int array[10]; int array_box[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; int i, j, k, x, y; //rows=i, columns =j for (i=0; i<9; i++) { //Reset test array for (x = 0; x...