Most voted "matrix" questions
An array is a collection of variables of the same type, accessible with a single name and stored contiguously in memory. The individualization of each variable of a vector is done through the use of indexes. Vectors are matrices of a single dimension.
Learn more…508 questions
Sort by count of
-
1
votes1
answer652
viewsPython - Tabuada- For Exercise - Matrix
Good night! I’m trying to create a tabuada program using for and matrix, my code is like this at the moment: def crie_array(rows, columns, value): matriz = [] for i in range(linhas): linha = [] for…
-
1
votes0
answers27
viewsExercise with Indefinite Matrix of Strings
I am trying to do an exercise where the user through a random sequence decides the size of the Board (Matrix) and how the values will be organized. Because it is a game where the 3 Robots(Recognized…
matrixasked 5 years, 7 months ago FelpsFranco 11 -
1
votes1
answer65
viewsOrganize a matrix
I have an array containing 16 objects, each object has the title, and definition attributes. I need to put inside each object in the definition attribute,. [{ titulo: universo, definicao:["(Física)…
-
1
votes2
answers120
viewsBingo program does not identify who has won
Trying to make a bingo with matrix in C, however the verification of the drawn values does not identify correctly with the matrix. #include <stdlib.h> #include <stdio.h> #include…
-
1
votes1
answer170
viewsC matrix showing large numbers and not typed
I’m having a problem in at least all my matrices made in class, I even caught a fixed problem of the internet and my matrix on PC is still showing random numbers. the code is as follows: : void main…
-
1
votes1
answer65
views -
1
votes2
answers108
viewsHelp in python Lists
Good night I’m having a hard time with this: [['1', 0.0, 1.8], ['1', 3.0, 2.0], ['1', 5.0, 1.5], ['1', 6.0, 1.5], ['1', 9.0, 3.0], ['2', 0.0, 1.8], ['2', 1.0, 1.5], ['2', 2.0, 1.5], ['2', 3.0, 2.0],…
-
1
votes2
answers267
viewsAdd values for same-day array
I have the following array: array (size=3) 10 => array (size=13) '11/06' => int 104 '18/06' => int 145 '25/06' => int 136 '02/07' => int 135 '09/07' => int 122 '16/07' => int…
-
1
votes1
answer698
viewsHow to pass matrix as parameter in C?
Hello. In general, I know that to pass an array as a parameter of a function in C, we have to specify the size of its dimensions. But this makes the function less generic. I was thinking of using…
-
1
votes0
answers41
viewsWhy is my matrix rewriting itself?
I want to create a square matrix of order N (N is read), but when entering the loop, my matrices are rewriting themselves and always assuming the last number I typed. I tried to change the range,…
-
1
votes0
answers30
viewsPlot lines from two different matrices in R?
I have two matrices with same number of rows and different number of columns. Each matrix is a sample, each row is a compound (1,2 and 3), and each column is the residue number. The value in the…
-
1
votes1
answer94
viewsHow to create a matrix with dynamic allocation and structs
I know how to create a matrix using dynamic allocation only. However, I’m not able to create using structures. I have the following struct: struct matriz{ int** elemento; int nlinhas; int ncolunas;…
-
1
votes1
answer210
viewsThread Pool for multiplication of arrays in java
In short: How can I split matrix operations and pool threads with a fixed amount of threads using the amount of user cores? I’m cracking my head, looking at the gringo SOF, but nothing that clears…
-
1
votes1
answer180
viewsHow to add an array inside a python Matrix
Hello I’m having a problem in python I’m taking an excel a Matrix of 15 columns and 3 rows, so I’m reading excel with pandas and did that while below to read all columns and all rows: import pandas…
-
1
votes0
answers54
viewsHessian update in BFGS method
I’m developing the nonlinear optimization method BFGS (Broyden-Fletcher-Goldfarb-Shanno) and I’m having a hard time updating the value of Hessian to minimize function. The input variables for…
-
1
votes1
answer88
viewsPython script that generates a main diagonal character square
I am trying to make a program that given a value, generates a "square" of n rows and n columns that has characters : in the main diagonal positions and the characters + in other positions. For…
-
1
votes1
answer41
viewsError trying to print an array with larger elements from two other matrices - 'int' Object is not subscriptable
In my code, I create two matrices, and compare the elements of the two in each position. The largest element at each position is selected and placed in the third matrix. When I finish all the…
-
1
votes2
answers229
viewsHow to receive a character array in C with for?
Considering Mxn as 2x2, I need to receive in each Mxn position a character. for example: r d g h for(i=0; i<m; i++){ for(j=0; j<n; j++){ printf("Digite um caractere para a posicao %d x %d da…
-
1
votes1
answer63
viewsProblem when trying to rotate a triangle using the javascript canvas
Guys, below, I have the following codes in a basic structure using html, css and javascript. I tried anyway, but I couldn’t rotate the triangle in the middle when the user slides the input range.…
-
1
votes0
answers46
viewsProblem with ARRAY_SEARCH function and Matrix in PHP
Hello, I’m making a PHP code that picks up a CSV file and am separating the file by "column" States. I want to make a matrix separating the states that repeat as follows:…
-
1
votes2
answers81
viewsMultiplication of Matrices in Fortran
I am encountering a problem to compile a program in Fortran. The build error accuses that the Shape of the matrices are not compliant. However, I understand that it is mathematically allowed to…
-
1
votes1
answer32
viewsHow to properly traverse a matrix allocated in C?
Whenever I walk through my char matrix (char**) it changes all positions with the value of the last node, example; char** string = AlocaMatriz(10,10); //retorna uma matriz char** 10x10 allocada char…
-
1
votes0
answers25
viewsRelate String matrix to a Float vector in C
I need the program to receive 20 names typed by the user, store in a Char Matrix, and right after receive the 20 salary of the users and store in a Float vector. I was able to do even the part where…
-
1
votes3
answers61
viewsHow to transform data frame variables into the indexes of a matrix with R?
I have a data frame with a lot of information and need to rearrange it in another matrix. The data frame is of the type: userID itemID rating 169 242 3 186 302 3 22 377 1 (the matrix has 10,000…
-
1
votes1
answer58
viewsReturning Multiple Values
The following code tells us to place a sequence of numbers in the following matrix and then assign a value to X and find out if the value of X is equal to some matrix value. But it is returning me…
-
0
votes1
answer940
viewsRepresent coordinates in Matlab vector
I am having problems creating an object vector in Matlab, the idea is that it is a coordinate vector, i.e. the x and y positions. The goal is to have a vector to access the coordinates in the loops…
-
0
votes1
answer263
viewsSet of 3 Java ports
I have to do an exercise in Java that consists in creating a matrix [3][3] and each line would be a phase of the game. The user should guess which door the prize is in. For this I need to make a…
-
0
votes1
answer395
viewsGo through 4x4 matrix with for, I don’t understand
I don’t understand that code: #include <stdio.h> #include <stdlib.h> int main() { int i, j; for(i=1; i<5; i++) { for(j=1; j<5; j++) { if(i==j) printf("1 "); else printf("0 "); }…
-
0
votes1
answer239
viewsInterleaved matrix
Hello, I’m doing this exercise, but I’m having a hard time. Follow the statement: 22) Write a program to generate one matrix (N x M) (<=20) and another (N x P) (<=20). Generate a third matrix…
-
0
votes1
answer34
viewsTilepane: how to create individual event on buttons
I have a difficulty using Tilepane, I can’t create an event for each button of the array. Follow the code for you to help me. `TilePane tilePane = new TilePane(); tilePane.setPrefColumns(3);…
-
0
votes1
answer793
viewsCode structure problem within switch case
When choosing option 1 (easy) the program enters case 1 correctly, but when I choose the port (0, 1 or 2) it goes back to the menu, the goal is that if the port is the right one it passes to the…
-
0
votes1
answer594
viewsHow do I print the location (row and column) of the highest value within an array?
Good morning, I’m not able to complete my code, I’ve already used For i in range and for j in range, but I can’t complete the code because I need to store the result in another variable and then see…
-
0
votes1
answer2443
viewsBattleship Java
Good morning, you guys, I’m doing an exercise in java on the game Battleship, I have a good part of the code but I’m locked on the part of validating the position of the boats. The exercise asks…
-
0
votes1
answer309
viewsJava: Filereader reading number not in the file
I have this TXT: 1,2,4,8,7 45,18,27,35,44 17,45,2,8,6 And I want to read this matrix to a Java array. Here’s the code: public static void main(String[] args){ double[][] pesos = null; String…
-
0
votes1
answer183
viewsDoubt about the use of `for` in voting system
I want to make a program where the user gives the number of candidates and their names, and then the vote is started until the user type order. Help? #include<stdio.h> #include<string.h>…
-
0
votes1
answer98
viewsHow to check the elements close to a specific element in a matrix?
The goal is to try to find on the college campus possible locations for building a new building. The user will enter the matrix representing the college plan. R = Ruas P = Prédios V = Área Verde E =…
-
0
votes1
answer384
viewsCompare rows of matrices with different dimensions and return a single logic vector
I have two coordinate matrices, matrix A with 83213 rows and two columns (longitude, latitude) and matrix B with 46886 rows and two columns (longitude, latitude). I would like to compare the…
-
0
votes1
answer228
viewsAssign element to matrix only when there is space?
I have some vectors that should be assigned in a 20x20 matrix, but no vectors can override each other and not be printed in different lines, they should be assigned vertically or horizontally. For…
-
0
votes4
answers457
views4x4 matrix with 20 elements
Galera made a code in Python whose exercise asked to make a 4x4 matrix , show the amount of elements larger than 10 and show the final matrix. I did and everything was fine only that the matrix ta…
-
0
votes1
answer3219
viewsHow to pass an array to a file . txt - MATLAB
I’m reading an image teste.jpg by command imread and turn it into a gray image by the command rgb2gray. I need the corresponding codes of the result of this matrix, in a file .txt. Follow the…
-
0
votes1
answer591
viewsAccessing a file using Properties
I am working with a method that takes as argument an object from the Properties class: public static void main(String[] args) { //Properties props = new Properties(); Properties props = new…
-
0
votes0
answers380
viewsReplace matrix elements with an "X"
I have code that should print a matrix according to the input. You should print the matrix so that the "X" forms a right spiral starting from the middle, someone has some idea? ps.:Code comments are…
-
0
votes2
answers879
viewsPass matrix to C functions
Good evening, next I have a problem passing a matrix to a C function. I have the following code void funcao(int mat[][num]); int main() { scanf(%d,&num); } It is basically the following, I…
-
0
votes3
answers72
viewsLargest number in array, does not display
This code does not show how the largest element inserted in the matrix should be or the correct position. What’s the mistake? #include <stdio.h> #include <stdlib.h> #define lin 4 #define…
-
0
votes1
answer65
viewsProblem with matrix editing outside of main()
So, guys, I’m in over my head with the code below. I started studying C pointers a few days ago and I believe it’s the solution to my problem, but I don’t know how to handle the code. The problem is…
-
0
votes1
answer453
viewsReturn number of rows or columns of an array
I have a matrix like this in Delphi XE8: Matriz[2][3]. I wonder which method can I use to return the number of rows or columns in this matrix, my idea is to loop with 2 for's and traverse the matrix…
-
0
votes2
answers44
viewsSearch for more data after finding nothing related to ID
I am making a 4x4 matrix system for a client and I am having a difficulty in the following question: The system has to check if the indicated to be checked already has 4 people in the network, if…
-
0
votes2
answers349
viewsDynamic matrix creation that stores broken text
Attempt to create a dynamic matrix using malloc(). I am in doubt if the parameters I send to the different cycles of the function will be right. int size=0,i,j,n=20; char str[]="Ola. Tudo bem?\n Sim…
-
0
votes1
answer658
viewsHow to count repeated arguments in R
I have a spreadsheet, I have to do some operations in the data, so I exported to R and can select the important arguments, now I need to know how many repeated elements there are in a column: for…
-
0
votes2
answers86
viewsProblem with dynamic allocation of bidimencional matrices in C
I need to make a product of matrices in which the user must enter the dimensions and terms of the matrices, but the program simply stops working. Follows the code: #include<stdio.h>…