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
-
0
votes1
answer1119
viewsHow to check if the matrix is symmetrical?
I’m doing a college activity where you ask to check whether the matrix typed by the user is symmetric or not. Here is my code: #define TAMANHO 4 #include <stdio.h> #include <stdlib.h>…
-
0
votes0
answers38
viewsCheck whether a string is contained in a char matrix in horizontal or vertical JAVA
For the time being I’ve written this function public static boolean isHidden(char[][] board, String word){ boolean check = false; for(int i = 0; i < (board[0].length); i++){ for(int j = 0;…
-
0
votes1
answer189
viewsError in 3x3 matrix
I’m having difficulties in a java code. I’m trying to make a code that generates a 3x3 matrix. I made a code that at first glance works everything Okay. matriz3x3 public static void main(String[]…
-
0
votes1
answer763
viewsError type Mismatch: cannot Convert from String to String[] - How can I fix?
When trying to receive value through a JOptionPane in a matrix, but gives this error: type mismatch: cannot convert from String to String[] How can I correct? Follow my source code below: package…
-
0
votes2
answers129
viewsMatrix with C++ Strings
I would like to create a C++ Mxn array for storing strings, like the matrix below: [['3325309756482910474', 'CARRO', '2506794813021649539', '618.57'], ['3325309756485249504', 'MOTO',…
-
0
votes0
answers25
viewsmatrices without size in C
I have a doubt that came to me while learning about matrices of a dimension (no size). Follow an example: #include <stdio.h> int main(){ int matriz[] = {1,2,3}; } My question is: and if I then…
-
0
votes0
answers98
viewsC Matrix Printing Error
I’m trying to fill a matrix recursively to get how many vector values are equal, but it’s not working and I don’t know where the problem is. The matrix is generated by comparing 2 strings If the…
-
0
votes4
answers3471
viewsMatrix generator in Python
The program does the following: I say the number of rows and columns I want in my matrix and then assign a value to each column in each row, the problem is that when I specify the number of rows…
-
0
votes1
answer800
viewsedges of an N x N matrix
I would like to know how to set the edge values of an array to -1. I tried to create an array of N+2 x N+2, and to do with one just, go through the edges, but when I put to print it displays some…
-
0
votes1
answer289
viewsHow to multiply all elements of an array by number in Python?
I need to do a function that given a matrix and a number, returns the resulting matrix by multiplying all elements of the matrix by that number. I tried something like this: def mult(matriz, n):…
-
0
votes1
answer34
viewsFunction does not work in all test cases
I need to do a function to check if a matrix is square: def eh_quadrada(matriz): '''Função que verifica se uma matriz é quadrada. list->bool''' if len(matriz)==len(matriz[0]): return True else:…
-
0
votes2
answers912
viewsPython: find product of the highest value of each matrix list
Dear Ladies and Gentlemen(s), I’ve done a lot of research before posting my question. I am already discouraged. This is a university job. If you can give me a hint, I’d appreciate it. The exercise…
-
0
votes2
answers3022
viewsRepeat number check on matrix in C
I am not able to find the error of this code. I did it to check if in a 4x4 matrix the number being inserted already exists. For some reason that I do not know he accepts the times repeated values…
-
0
votes2
answers38
viewsComparison of content in matrices
Have some python solution to use something similar to np.all in arrays that are filled with strings or ints? Below an example of what I wish, perform the comparison of a row of the matrix to verify…
-
0
votes0
answers36
viewsHow to count occurrences of a number in a matrix?
I need to do a function that counts how many times a number appears in a matrix, example: ocorrencias(9,[[9,7,6,9,8,8]]) Must return 2 My code: def ocorrencias(numero,matriz): cont = 0 for elemento…
-
0
votes1
answer34
viewsFunction Result in an Object Array?
How to turn the output of this function into a array? In the future I would like to call only the result of a specific line, such as $palavraschave[1]. <?php $url=…
-
0
votes0
answers15
viewsI need help finding an error in a program
[ in this image is the program code, DEV C++ pointed errors on line 5 and line 6 as shown in the pictures below I’ve tried everything but I can’t find the error…
-
0
votes1
answer26
viewsHow to sum the lines of a two-dimensional vector and show the result of the sum of each line?
for (int i = 0; i < vetor.length; i++) { for (int j = 0; j < vetor.length; j++) { soma += vetor[j][i]; } System.out.print("Aluno " + (i + 1) + " : "); System.out.println(soma + " "); }…
-
0
votes1
answer1626
viewsdouble free or corruption(out) - Dynamic Allocation in C
In the discipline of Data Structure in college, as an exercise, the implementation of an algorithm that manages the transposed matrix of a given dynamically allocated matrix was passed. I made the…
-
0
votes1
answer221
viewsFill cells with AN by an annual logical sequence in R
I have a dataframe with 25 people and their respective ages from 2012 to 2015, but in a few years the ages were not filled. id<-c(1:25) idade_2012<-c(21, 18, 19, 25, 20, 12, 12, 13, 14, 29,…
-
0
votes1
answer515
viewsPass pointer array to function
I need some help with this exercise. I did the whole exercise and runs well only that in the end gives error because of passing the address of the matrix to the function. What’s the problem here?…
-
0
votes1
answer671
viewsSort matrix of n rows using the column value in C as a criterion
I have the following code : int** ordena(int **v, int tam) { int i, j,aux; int swap[3]; for (i = 0; i > (tam-1); i++){ aux = i; for (j = (i+1); j > tam; j++) { if(v[j][1] > v[aux][1]) { aux…
-
0
votes1
answer222
viewsGroup, assign, and sort values from a multidimensional array in PHP
Hello, everyone. I have the following multidimensional array in PHP: Array ( [0] => Array ( [0] => teste0 [1] => 1 ) [1] => Array ( [0] => teste1 [1] => 1 ) [2] => Array ( [0]…
-
0
votes2
answers717
viewsHow to separate vowel consonants into a matrix in C
Hello, I have a problem with my code. I have a matrix[6][3] that reads letters, after reading I want to separate the vowels from the consonants. However I did not succeed because all the letters go…
-
0
votes2
answers32
viewsCopy a square matrix of tam n into another complemetar n-1, omitted row 0 and column 0 of matrix n
#include<stdio.h> #include<stdlib.h> #include<limits.h> #include<locale.h> int main(){ int i,j; int mat[3][3]; int comp[2][2]; …
-
0
votes0
answers63
viewsGenerate a matrix without repetitions
I need to make a code that takes an array and puts random numbers on it, no repetitions. I am able to generate the matrix, however, it still has some repeated numbers ;-; #include <stdio.h>…
-
0
votes0
answers489
viewsFunction to multiply each row of a matrix by the value of its corresponding secondary diagonal
I’m not getting the values of the secondary diagonal of a matrix by a function. /* 19) Elabore uma sub-rotina que receba como parâmetro uma matriz A(6,6) e multiplique cada linha pelo elemento da…
-
0
votes1
answer145
viewsHow to convert hexadecimal to binary in a matrix in r?
I have a matrix with hexadecimal number, so: [,1] [,2] [,3] [1,] "FA" "F8" "D0" [2,] "CE" "17" "6A" [3,] "0E" "D6" "22" If I try to convert into binary, with hex2bin(matriz) (biblioteca BMS), is…
-
0
votes1
answer549
views -
0
votes1
answer31
views -
0
votes1
answer66
viewsWhy Does My Function Bubblebest Doesn’t Rotate?
I’m wanting to call the bubbleSort code but it does not appear to run and I can’t figure out the problem since it shows no error. #include <stdio.h> #include <stdlib.h> #include…
-
0
votes1
answer1515
viewsInvert row with column in a matrix?
Make a program that randomly generates 20 integers in the range of 0 to 999 and fill in a matrix of size 5 x 4. Show the matrix, then show the transposed matrix (reverse row with column). I’ve…
-
0
votes1
answer63
viewsHow to play letter by letter of a sentence in an array?
Example: in the sentence naruto, the letter n vector frase is in position frase[0]. I want to put it on mat_cript position [0][0]. Not only her, the rest of the sentence too. #include…
-
0
votes1
answer425
viewsHow to delete items in an array? (Python 3)
I need to build a program where the user will be able to delete events from the event schedule, but the problem here is that when he deletes another event,I mean, after he has deleted the first one…
-
0
votes1
answer156
viewsRead char matrix from a binary file
Function that writes and reads binary file: int FUNCAO_QUE_GRAVA_BIN (char filename[],int partida1,char resultado1) { typedef struct { int partida; char jogvelha[3][3]; char resultado; } velha;…
-
0
votes0
answers55
viewsOverlapping values in the matrix
Ola has a matrix that is formed by a set of random numbers. However some of these sets of numbers overlap. What can I do? void ransnipa(int (*board)[40]){ srand(time(NULL)); int k; int x[snipa]; int…
-
0
votes1
answer451
viewsPoor performance when traversing an array
I’m traversing a matrix but face performance problems The idea would be to go through this matrix twice, in the second set of ties of the matriz_original if the condition is true the new matrix…
-
0
votes2
answers215
viewsWhy can’t I pass a matrix as a parameter of a function in C?
Dear friends, today I have come across a problem I cannot understand. When trying to pass an array as a parameter, I cannot access the values of the elements, I always access the memory addresses of…
-
0
votes1
answer289
viewsRescue indexes from my data elements.frame
I have a data.frame that is filtered from another data.frame. (see image below) However, I would like to filter this data.frame again and retrieve its original indexes in a vector. Example: Let’s…
-
0
votes2
answers470
viewsread the elements of an input matrix
I have a code that represents a checkerboard (8x8 matrix): print(f'ATENÇÃO: ') print(f'Insira 0 nas posições vazias do tabuleiro;') print(f'Insira 1 nas posições das peças pretas e 11 para as damas…
-
0
votes0
answers43
viewsI got an error trying to create my matrix. Error: Warning Passing argument 1 of " " from incompatible Pointer type
I’m trying to create a code with a 3x3 matrix. However, I haven’t touched C for a while and I needed to review this content. I believe that the failure of the program is some question related to…
-
0
votes1
answer142
viewsTotal count of characters without strlen
I need to count the total number of characters present in any word without the function strlen(). First I performed the word reading, after using a for to go through the word, within the for I used…
-
0
votes0
answers249
viewsPython matrix sum 2x2
m = [] for l in range(0, 2): m.append([]) for c in range (0, 2): valores = int(input("Digite valores: ")) m[l].append(valores) print("-"*30) print(m) print("-"*30) for l in range(0, 2): print("|",…
-
0
votes1
answer114
viewsVariable does not display correct result in C
I have the following problem to solve: Write a program that reads two matrices of 10 rows and 2 columns. Each row of the matrix stores two notes of a student. The first matrix stores the notes of G1…
-
0
votes1
answer146
viewsChange the quadrants of an even-sized matrix
I get an array, and I must print it on the screen as shown in the image below. This is the current code: #include<stdio.h> int main(){ int matriz[4][4] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,…
-
0
votes2
answers60
viewsMatrix initialization not working from a given line
I need to initialize a matrix that contains the binary values from 0 to the input value, which in this case is 15. The base conversion and the storage of these values works well until the number 8.…
-
0
votes1
answer288
viewsMatrix Binaria in C
I need to initialize a matrix that contains the binary values from 0 to the input value, which in this case is 15. The base conversion and the storage of these values works well until the number 8.…
-
0
votes3
answers335
viewsError when De-locating Matrix - double free or corruption C
Hello, I’m running a program to rotate a matrix, which after allocating executes the rotation function, and then displaces the data. The problem is when I try to dislocate, it’s returning me double…
-
0
votes1
answer151
viewsJavascript - Take for result and put each result inside an array
Hello, someone can help me in this matter. I would like to place each result inside my new array. Example, my for generates the result of 9 Array. success: function(res){ for(i in res){ var dados =…
-
0
votes3
answers1384
viewsProblem with Python matrices
Hi, I’d like some help. I have to generate, in Python, a matrix with a number l of rows and a number c of columns, and calculate the sum of the main and secondary diagonal elements. The sum is done…