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
votes2
answers280
viewsCheck the diagonal of a specific index
I wanted to know how to check the diagonal of a particular index, for example, put 1 in all the numbers of the diagonals of row 2, column 2 0 1 0 1 0 0 1 0 0 1 0 1 1 0 0 0…
-
-1
votes1
answer1088
viewsHow to read a variable of type unsigned char by the fscanf function?
I am reading an array of a file where each element of this matrix varies from 0 to 255. For this reason I have stored the values within an array of unsigned char type, but am finding some problems…
-
-1
votes1
answer55
viewsAdd values in a 3-dimensional matrix
How do I get the user to add values to an array [][][]? calendarioEventos = new Evento[dia][mes][hora]; for(int i = 0; i < calendarioEventos.length; i++) { for(int j = 0; j <…
-
-1
votes1
answer1660
viewsHow to turn diagonal elements of a python matrix into a list
I have the following matrix, for example: matriz = [[1, 2, 3, 4, 5, 6], [7, 8, 9, 3, 8, 9], [4, 5, 2, 3, 4, 4], [2, 3, 4, 5, 3, 6], [4, 5, 3, 4, 5, 6]] I would like to obtain only the elements of…
-
-1
votes1
answer122
viewsProblem with passing parameters/return of function matrices in C
I’m having a problem with a job I have to do in C consisting of, get the inverse matrix through the adjunct matrix. So far this is what I’ve been able to produce in C# and then tried to rewrite in…
-
-1
votes1
answer720
viewsSudoku game resolution giving infinite loop in C
I have the following code on C: #include <iostream> #include <stdio.h> #include <stdlib.h> #include <time.h> // Variáveis globais int jogo_tabuleiro[9][9] = {0}; int…
-
-1
votes3
answers926
viewsPrintar Vector in C
I would like to print one vector[300] and another [500], but in a way it seems to be, for the user, an array... for example, I did one of [100], where I made the loop to print this vector and an…
-
-1
votes1
answer1320
viewsHow to navigate a matrix in Matlab?
Good evening! Can anyone help me with this exercise? "Create a filename filter_matrix. m and save it to your personal account. Type a function name filter_matrix that receives a matrix as an…
-
-1
votes1
answer124
viewsRandom Boolean Matrix in C++
good afternoon. I need to develop a Boolean matrix (almost a graph) random in C++, but I confess I used a lot of python, so I’m having a hard time getting started. But the focus of the question is,…
-
-1
votes2
answers235
viewsMatrix 3x3 in PHP, how to show only the elements of the tips
would like to know if there is any specific condition for me to print only the elements of the matrix tip(1,5,13,17). <?php $matriz = [ [1,3,5],//1 [7,9,11],//0,2 [13,15,17]//1 ]; for($l=0;…
-
-1
votes1
answer82
viewsErrors when defining the edges of an N x N matrix? Index: list index out of range
I created a function that takes as a parameter an Nxn matrix, and initially prints the top edge of the matrix, but I keep getting the error "Indexerror: list index out of range", and this prevents…
-
-1
votes1
answer40
viewsAlgorithm problem in C
Good afternoon, I’m trying to make a program to estimate the contagion from some parameters, but the program is not working properly, it does not create file, and has not printed any of the prints I…
-
-1
votes1
answer37
viewsNumber of elements in ndarray vector
I have the following function to count how many "player" appear in the array estado[i], which is a line of a matrix: for i in range (0, len(estado)): if (estado[i].count(jogador) == len(estado)):…
-
-1
votes1
answer35
viewsHow do I print an array in the form of rows and columns?
#include<stdio.h> #include<stdlib.h> int main(){ int m[3][2]; for(int i=0; i<3; i++){ for(int j=0; j<2; j++){ printf("Digite o elemento na linha e coluna [%d],[%d]: ", i, j);…
-
-1
votes1
answer57
viewsReceive more than one value per line with C
I need to make a code where it is necessary to receive more than one value per line, however I do not know how many values The initial idea would be to use scanf("%d", valor); However, in that case…
-
-1
votes1
answer343
viewsDictionary for objects in Python
I wonder how I can assign a dictionary to a set of objects. For example, I have a 4x4 vector of 'neuron' objects': [[<__main__.Neuronio object at 0x1035644e0>, <__main__.Neuronio object at…
-
-1
votes1
answer210
viewsHow to verify that vector fields are null?
I am building a program, which should initially check whether the array of type (Class) is null. My class has the get and set method, as well as the constructors with and without standard. However,…
-
-1
votes1
answer68
viewsHow to Assign a Phrase to a line in a chars matrix?
I want to modify standard phrases from a theoretical game. For example, the game has the phrase "Choose a command" and, over a given state, I would like to exchange all letters "o" and "a" for a @.…
-
-1
votes2
answers138
viewsProblem in realizing the sum of the lines of a two-dimensional matrix C++
include include using namespace Std; int main() { srand(time(0)); int bid[3][3]; int impar = 0; for (int x = 0; x < 3; x++) { for (int y = 0; y < 3; y++) { bid[x][y] = rand() % (386 - 0 + 1) +…
-
-1
votes2
answers528
viewsWriting in a C++ matrix
I am studying and implementing some C++ schemes but it is causing errors when assigning value to the matrix. Well... I have a txt file that contains lines with "[email protected]" content. My Ret…
-
-1
votes1
answer163
viewsHow to use a function to fill all positions of the dynamically allocated vector?
Good afternoon guys, I’m seeing for the first time the C language and I’m not making progress on a job. First you are asked to create a function int receive Operator() This function will request the…
-
-1
votes1
answer168
viewsHow to read a txt matrix
I needed to print a matrix I have on txt in the terminal. This is my txt: 010009070 300001000 070080000 807000000 050076000 064000510 030200000 092400000 000000023 What I’ve already tried: int…
-
-1
votes1
answer36
viewsFunction does not modify the Matrix after the second call!
I’m making a small game, however, I need to call this function 3 times, in the first call of the function it performs as expected, however, in the second and third call it does not do what I expect.…
-
-1
votes2
answers991
viewsTransform matrix into vector
I am doing some exercises with matrix and array, and I arrived at the following situation: static void Main(string[] args) { int linha = 3; int coluna = 3; int[,] matriz = new int[linha, coluna];…
-
-1
votes1
answer387
viewsHow it shows the row and column position of a matrix in C and sums the row and column
Good afternoon Guys!!!! I know the question seems silly, but I’m starting now in programming needed to do a C program with a MATRIX[4][4] as described here below. I’ve been trying for a few days,…
-
-1
votes1
answer95
viewserror: assignment to Expression with array type
I’m having a problem where I assign values to the matrix and to the vector but I still have the attribution error. I’m new to the forum and I still don’t know how things work right, if information…
-
-1
votes2
answers67
viewsSum of 3 matrices in a new matrix
I need a program that adds 3 matrices of Nxm size. The user should be able to set the size (Nxm) of the matrices. But I don’t know what’s wrong. Java int linha = i; int coluna = j; int[][] matriz =…
-
-1
votes1
answer80
viewsShow all possibilities of Python numbers
How do I show all possibilities according to the number of bit quantization, for example: user: 8 levels bits: 3 need to show then: 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1 my code so far,…
-
-1
votes1
answer162
viewsHow can I catch checking the diagonals of a word search?
I’ve already checked some codes here on the site, but I’m not getting it. I am creating a program that receives a word hunt and shows in the terminal where the previously declared words are.…
-
-1
votes1
answer155
viewsConverting a list of lists of vectors into a list of matrices - R
I’m working on an environmental model that returns a list of vectors. Each list corresponds to a point in space, and each vector is a time series of data for different variables. I’m trying to…
-
-1
votes2
answers44
viewsStore words in a "char" vector
I’m trying to make an algorithm that returns the region of the CPF that was informed, but I’m bumping into the character limit that a variable of the type char allows in C language. I tried to…
-
-1
votes1
answer18
viewsAssemble an Array of at most 10 x 10, which the user chooses the order in a function, and then assemble the matrix in another function
Write a program that reads an array (maximum 10 x 10). The order matrix is chosen by the user. Next use a function to: a) Read integer values from matrix; b) Show matrix values; However, it is…
-
-2
votes1
answer126
viewsDrawing of positions of a matrix
I need to create a function to draw within a matrix full of 0 with size n x n, four positions to modify the value only of these drawn positions.
-
-2
votes1
answer927
viewsMake a function that receives a matrix A(10,10) and returns a vector with the sum of each of the lines of A
I’m trying to solve this problem. #include <stdio.h> /* 5. Faça uma função que receba uma matriz A(10,10) e retorna um vetor com a soma de cada uma das linhas de A. */ int matriz[3][3]; void…
-
-2
votes1
answer79
viewsInsert n points of a vector randomly into any matrix in java
I’m beginner in java, I was wondering if there is any function that would facilitate my life so that: having a vector of n positions filled with (pre-defined) numbers, distribute these numbers at…
-
-2
votes2
answers10417
viewsHow do I multiply two matrices in python?
def multM(a, b): '''essa foi a função que eu tentei fazer''' if len(a) == len(b[0]): r = [] for i in range(len(a)): r.append([]) for j in range(len(b[0])): for k in range(len(a)): val = a[i][j] *…
-
-2
votes1
answer105
viewsautomatic matrix with python rule
How I would create a 2-column array in python as follows. where the first column adds 0.28++ to 100%, and the second column is the percentage value of 1 column * 342.…
-
-2
votes1
answer46
viewsHow to scan the matrix using only one for?
The circumstances are in the code that works: String[][] compras = new String[][] { { "item 1", "1.70" }, { "item 2", "39.90" }, { "item 3", "9.90" }, { "item 4", "4.90" }, { "item 5", "7.90" } };…
-
-2
votes1
answer40
viewsI need to print a L1 line of a matrix in C
After reading L1 in main, I need to pass line A[L1] to a function and print this line Prints(A[L1]), only it gives an error saying that it does not recognize the parameter. What can it be? void…
-
-2
votes1
answer264
viewsMatrix - Python
I’m doing a college paper that requires me to do the Space Invaders game. I was able to make the game matrix and now I need to put the ships inside it, for now it’s like this: I need to print the…
-
-2
votes1
answer185
viewsProblems with Two-Dimensional String Matrix
My objective in this exercise is that in each loop to make a new snack order, the informed data be added in the final table (matrix[i][j]). In the second "for" is where I try to assign the variables…
-
-2
votes2
answers480
viewsDisplay matrix in python
I have a matrix of n by n and use this part of the code to present it: for i in range(len(data)): for j in range(len(data[0])): print ((data[i][j])) Being data the matrix. But the output looks like…
-
-2
votes1
answer497
viewsIdentify if a matrix is triangular upper, lower or diagonal
I need to receive a matrix and identify if it is an upper triangular matrix, a lower triangular matrix or a diagonal matrix (upper+lower) I wrote a code initially to find out if it is diagonal…
-
-2
votes1
answer85
viewsPython Array - Highest list value
I’m having trouble solving an array exercise in Python, can help? Description: A store with 4 branches wants to register the daily sale of each branch for 1 week period. Create an array to store the…
-
-2
votes1
answer38
viewsUse a 30 x 3 array using class, def, parameters - Python
The intention here is to use a matrix capable of storing in each position all the information related to a given service (number, value, service code, customer code). Each row represents one day of…
-
-2
votes1
answer495
viewsAttributeerror: 'numpy.ndarray' Object has no attribute 'append'
The program below serves to calculate two matrices (w1 and w2) and, from them, calculate an f rmula (called transmission matrix) and after that take the results of this matrix and trace the…
-
-2
votes1
answer30
viewsSearch in Javascript array
Good afternoon. I ask you kindly to help me in a simple problem (for you kkk), but that is bothering me. I have a fixed matrix (values are taken from a txt) need a return function another matrix…
-
-2
votes1
answer80
viewsHow do I make my matrix scheduling algorithm work in python?
I need to make a program in python that reads a matrix A nxn and a vector B and then solve the system Ax=B, the function q I am using for the first part is global n n= int(input('Qual será a…
-
-2
votes1
answer245
views4x4 matrix in C language
Objective: To sum two 4x4 integer matrices with the prototype below, predefined by the exercise. Prototype to be used: void calc_soma(int* mat_A, int* mat_B, int* mat_C); The prototype was made as…
-
-3
votes2
answers82
viewsfill as data an Array up to a specific value
I need to make a program that reads the keyboard names until the user type the word "order", and then print the typed names in the order they were typed. So far, I’ve tried to resolve this issue…