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
-
4
votes2
answers588
viewsHow do I correctly access elements of a dynamic matrix via pointer?
As many know (I believe) a multidimensional matrix is stored in memory in a linear way, that is, each line of the matrix goes in memory one after the other. To illustrate I elaborated the following…
-
4
votes3
answers459
viewsStore values in matrices
I am using codeblocks, I am beginner in programming, starting with C, on account of college. The error is this: In the part of the code where it stores the value of the average of the student, only…
-
4
votes1
answer76
viewsArray Ordering with Value Exchange
Good Afternoon! I have assembled an array that receives 9 records from a single variable and the values are displayed on the user screen. However, when trying to put this matrix in ascending order,…
-
4
votes1
answer117
viewsResize a vector in Matlab
Good afternoon. Here’s the following, I used the following function to create an empty array that later stores certain values requested from the user: fragil = zeros(1, 10); %criaçao do vetor idF =…
-
3
votes1
answer196
viewsHow to use Qvector<Qvector <double> as matrix?
In the mainwindow.h have: private: QVector<QVector<double> > numbers; //Variável que será minha matriz public slot: void realizar_calcs(QVector<QVector<double> >…
-
3
votes1
answer244
viewsMatrix in Forms
I’m having trouble creating a matrix within a JPanel in Netbeans, I tried to customize the code by placing within the Netbeans customization code: jPanel1.setLayout(new GridLayout(15,15));…
-
3
votes3
answers1031
viewsReplace Zero and Infinity values in a matrix (R)
In the example matrix below (daily stock returns) : IBOV PETR4 VALE5 ITUB4 BBDC4 PETR3 [1,] -0.03981646 -0.027412907 -0.051282051 -0.05208333 -0.047300526 -0.059805285 [2,] -0.03000415 -0.030534351…
-
3
votes1
answer558
viewsCreate frequency distribution matrix in R (categorical variable VS numeric)
I have two columns: supply situation (categorical variable) and number of students (numerical variable). I want to create a table that tells how many students are in each modality (class/levels).…
-
3
votes1
answer3385
viewsReplace specified column values in a matrix (R)
At the head office (ret_matriz) IBOV PETR4 VALE5 ITUB4 BBDC4 PETR3 [1,] -0.040630825 -0.027795652 -0.052643733 -0.053488685 -0.048455772 -0.061668282 [2,] -0.030463489 -0.031010237 0 -0.040229625…
-
3
votes2
answers2857
viewsCompare 2 Matrices and Return a Third (R)
The following matrices being Matrix(A) [,1] [,2] [,3] [,4] [,5] [1,] 0.228 0.285 0.285 0.285 0.380 [2,] 0.228 0.285 0.570 0.380 0.228 [3,] 0.380 0.285 0.228 0.380 0.285 [4,] 0.285 0.285 0.570 0.380…
-
3
votes1
answer1272
viewsHow to return the index of a matrix and its value in different variables?
I have a matrix of the following structure Matriz[indice][valor] How I return the index in one variable, and the value in another? Odd example: $indice = $matriz[indice] And for the value: $valor =…
-
3
votes2
answers2182
viewsRepeated elements in a matrix
I’m trying to make an algorithm that finds repeated elements in some matrix but I don’t know how. The algorithm should not check the repetition only in the rows or columns, but in the whole matrix…
-
3
votes1
answer309
viewsAccessing values from an object array
I have a job where I should create a parking, in the basic Java same. So I have my class Carros: package estacionebemestacionamento; import javax.swing.*; import java.util.Date; import…
-
3
votes1
answer633
views -
3
votes2
answers63
viewsMajority vote in matrix in R
I want to compare elements of a matrix, for example, in row 1 (fixed) I want to know which object happens with the most frequency and return the same, precise in an automated way, because the number…
-
3
votes2
answers846
viewsCount line in the matrix that have repeated numbers
I wanted to add to linhaPreta the number of lines with only 0, and the linhaBranca only with 1. public class Pixel { public static void main(String[] args) { int[][] img = { { 1, 1, 1, 1, 1, 1, 1, 1…
-
3
votes1
answer115
viewsVector calculus C++
I need to implement some vector and matrix operations, such as internal product, vector, other operations with matrices (inverse, transposed, conjugated, determinant, etc.) and to solve certain…
-
3
votes1
answer391
viewsError Pointer to pointer in c++!
I created a Matrix class, to manipulate a matrix. In the class statement I have the following members (publicos): class Matrix{ public: unsigned char **mat; //ponteiro para ponteiro de uchar int…
-
3
votes3
answers4632
viewsWhat is the difference between one-dimensional and two-dimensional matrix?
In high school we usually study about the concept of Matrix, which consists of a row table and columns forming a set of numbers or elements. In mathematics, programming and other areas we use…
-
3
votes3
answers3097
viewsHow to generate random matrices without repeating numbers on the same line?
I want to store random numbers from 1 to 60 in an array. When there are equal numbers on the lines, it is to generate another random number. Type, cannot be: 11 55 55 43 49 30, and yes should be 11…
-
3
votes1
answer533
viewsSetting matrix table in Django
I have two tables, in the example (any) of the figure below i have the table Paises and the table Energia Setting a third table in Django I would have something with the fields pais, energia, valor…
-
3
votes2
answers321
viewsProblem with hasNext() Java
Hello, I have a problem, I scan a txt file, then I invoke a method to go counting the lines of this file, after returning me the number of lines (to give the size to the String Array equations)I…
-
3
votes1
answer2225
viewsAdjacent values
I need to create an algorithm that calculates the minimum distance value between the indexes of a matrix that contains adjacent values. But what are adjacent values someone could give me examples?…
-
3
votes1
answer163
viewsIn a matrix Z of elements (i,j) how to assign the value 1 when i=j? (software R)
Under the following condition: ifelse(??, 1, Z/(1+1)) What to put in place of "??" so that R understands that when i=j in the matrix Z, I want to assign the value 1?…
-
3
votes2
answers1064
viewsJava constructor with matrix
I am learning about constructors in java but I stopped in college exercise that seemed simple, the proposal is to create a constructor class with a matrix, and call it in another class to assign the…
-
3
votes2
answers797
viewsWhy can you pass a char vector to the scanf as the direct address or variable?
If the name of the vector or matrix is already the address of the first element, why scanf(), using the primitive types (int, char, float, double) I need to pass the address, being that when we want…
-
3
votes1
answer1231
viewsSorting of string and number vectors
I’m having a problem with a college exercise. Basically it’s a shop system, where I come in with the amount of stores, the amount of products, the name of the products, and the amount of products in…
-
3
votes2
answers15417
viewsHow to add the diagonal of a matrix in C?
Help me in the following exercise: Make a program that defines an integer array of size 5x5. Next, initialize this matrix with random numbers between 5 and 9. Finally, your program must calculate…
-
3
votes1
answer337
viewsRandom choice of lines in an array in R
I have a problem that produces a numerical matrix mxn being m the number of observations (row) and n the number of variables (column). I need to randomly choose p lines (p < m), without…
-
3
votes1
answer154
viewsReset repeated values of a matrix
Hey there, guys. I have an exercise where I must populate a matrix with random numbers from 0 to 9 and then replace the repeated numbers (except the first time the number appears) with the number 0.…
-
3
votes1
answer198
viewsDo not repeat letters (char) in an ASCII matrix
You had to create a 5x5 array by printing random characters from the ASCII table. public class ExercicioClass01g { static Scanner ler = new Scanner(System.in); public static char mat[][] = new…
-
3
votes2
answers48
viewsMatrix of Expression
I have the following matrix on R: FC12h FC10d FC6w -8.44770875 -0.37171750 0 -56.72384575 2.64778150 2.94636550 -3.00214850 2.64778150 -1.57755700 I need some function that causes numbers greater…
-
3
votes0
answers35
viewsThe Handle function is not converting - Matlab
Hello, I’m getting this mistake: Conversion to function_handle from double is not possible. I have already searched for the bug and tried to change the code but without success. Could you give a…
-
3
votes1
answer38
viewsManipulate matrix in Thematica
Good morning, I’m trying to make in thematica a matrix from other matrices, I have: {{{{a,b,c}, {d,e,f}, {g,h,i}},{{j,k,l},{m,n,o},{p,q,r}}},{{{j,m,p},{k,n,q},{l,o,r}}, {{s,t,u},{v,ww,x},{y,z,zz}}}}…
-
3
votes2
answers3049
viewsHow to print an array with indexes and values in PHP?
I have the following matrix in PHP: $matriz['HGF']['Christus'] = 7; $matriz['HGF']['Unifor'] = 6; $matriz['HIAS']['Christus'] = 5; $matriz['HIAS']['Unifor'] = 4; I would like to print the matrix in…
-
3
votes1
answer45
viewsLoop with R arrays
I need to create a matrix that has all the coordinates for a 128x128 matrix in R if it were a 3x3 matrix, ex: 1 2 3 1 a b c 2 d e f 3 g h i I would need the following matrix x y 1 1 1 2 1 2 3 1 3 4…
-
3
votes2
answers2190
viewsHow to pass a matrix as a reference to a function?
I’m trying to pass as a parameter a matrix for a function as a reference, and in this function do operations in this matrix but I’m not getting. I don’t want you to use define or const int for the…
-
3
votes1
answer651
viewsPython - Dismembering text file
Good night, I need to separate some lines from the file and according to the add line in another file. That is, a file that contains 6 words will be written according to the word for a specific…
-
3
votes1
answer62
viewsProblems with dynamic matrix allocation
I’m trying to dynamically allocate a matrix, but I’m having some problems with running time and I’m also getting a Warning of GCC in the compilation time. Follow the code below for a better analysis…
-
3
votes1
answer5597
viewsERROR The index was outside the matrix limits (System.Indexoutofrangeexception)
//Esse código tem o objetivo de substituir uma letra por um código string usuario = Environment.UserName; string palavra = usuario.ToLower(); int tamanho_array = palavra.Length; var array = new…
-
3
votes1
answer162
viewsDoubts Python Matrices
I am trying to create a function that returns the "minor complementary" matrix of any matrix. That is, given an array for example: mat=[[1,2,3],[4,5,6],[7,8,9]] The minor complement associated with…
-
3
votes2
answers69
viewsI need to know where in that code is my mistake - MATRIX C
In the letter i was to give 9,2 but the result that shows is 9,50. How to find out which class has the most homogeneity in relation to grades? float turma1[4][5] ={ {8.2,9.2,8.7,6.0,7.0},…
-
3
votes1
answer76
viewsWhy doesn’t the matrix print out all the typed values?
#include <stdio.h> #include <stdlib.h> #include <locale.h> int main() { setlocale(LC_ALL, "Portuguese"); int linha=0, coluna=0, i, j, l, m; int matriz_A[linha][coluna],…
-
3
votes1
answer158
viewsMatrix Loop with multiple vectors: Pyhton
Good evening, everyone I’m a beginner in Python and I would like your help, I did this program but the answer is in the form of several vectors or 24 vectors, and in reality I wanted only a…
-
2
votes3
answers830
viewsLoop in R with indexing and matrix
We’re trying to use the command for to run a y function (say y=5+3x+4z) varying the values of z (let’s say z is a combination of 5 values z=c(1,2,3,4,5)) and that x is a normal distribution of size…
-
2
votes1
answer1606
viewsCorrelation Matrix in R (cov.wt)
In the cov.wt function in R it is possible to obtain as a result only the Correlation Matrix ? cov.wt = Returns a list containing estimates of the Weighted covariance Matrix and the Mean of the…
-
2
votes0
answers105
viewsArduino - 8x8 matrix
I have an 8x8 led matrix and an Arduino uno and I intend to display some sentences in the matrix but I have not found in any way the datasheet. The numbering is HS-2388BS. There is another way to…
-
2
votes1
answer1157
viewsHow to display a matrix graphically?
I have a matrix Tabuleiro[][] tabuleiro = New Tabuleiro[20][20]. It contains objects from a class not yet implemented, which will have some values, such as cell color and a position marker. I would…
-
2
votes3
answers304
viewsHow to create a Standard Deviation Mobile Window (R)
A being the matrix below the return on shares (ret_matriz) for a given period. IBOV PETR4 VALE5 ITUB4 BBDC4 PETR3 [1,] -0.040630825 -0.027795652 -0.052643733 -0.053488685 -0.048455772 -0.061668282…
-
2
votes1
answer250
viewsApplying Loop to Elements of a Matrix (R)
Be the matrix below created from the Command simu_matrix <- matrix(runif(25,0,1),nrow=5,ncol=5) V1 V2 V3 V4 V5 1 0.07357303 0.45524021 0.9352829 0.60466424 0.4725541 2 0.51018615 0.46044203…