All Questions

Tagged with
-4
votes
0answers
24 views

Error while compiling code.. Two dimensional Array [on hold]

I have written the following code ; float *mavg(int count, int k1,int k2, float *datavalue){float *mag=malloc(sizeof(float)*count);//float data[count];float avg=0,sum=0;int i,j;for(j=k1;j<...
0
votes
1answer
36 views

How can I add increasing values to an increasing number of neighbours in an array in Matlab?

I have a geometry that consists of vertices and triangles. I have a matrix of size 3102x3 of which each row represents one triangle, and the columns contain the indices of the triangles that are ...
1
vote
2answers
42 views

Turning a matlab string with a numbers and colon to an array populated using colon

If I have some string newStr=1×1 cell array{'1 25 27 45 46 62 65 70 73 76 77:83'}Is there any way to directly convert this to an array?my_array=[1 25 27 45 46 62 65 70 73 76 77:83];which ...
0
votes
1answer
30 views

Spreading a given value over a given length of an array

I have a number 27.50.I want to spread it in an array Result, size of which is 2000.The distribution of 27.50 in array Result shall start from 1 and end at 27.50.number=27.50;Size=2000;...
0
votes
0answers
35 views

How to store string into an array in matlab

I have a variable that will receive foldernames and I would like to store those names into an array. here is the array declaration and piece of code that will hopefully do what i would want. the ...
0
votes
1answer
30 views

array of vector positions Matlab

I'm trying to create a cloth simulator and need a way of storing the particle positions. I would like to store them as [x,y,z]. I need an array for the all the particle positions. This would mean ...
0
votes
1answer
19 views

Update dynamically headers of DataTable in Matlab

Is there an efficient way of updating dynamically the headers of a Table after performing T=array2table(P) on a matrix P of dimension e.g.(1x120) rather than manually resorting to T.Properties....
0
votes
1answer
35 views

Interpreting an answer given as two arrays

What does this meansThe edges of the minimum spanningtree are returned in array mst (of size n-1 by 2)?When I run the program, at some point displaysthis two arrayshowever I don't know ...
2
votes
2answers
42 views

Extract indices of sets of values greater than zero in an array

I have an array of length n. The array has braking energy values, and the index number represents time in seconds.The structure of array is as follows:Index 1 to 140, array has zero values. (...
0
votes
0answers
44 views

Matlab: how do I apply a function along one dimension of an array

I have an array of mxnx4 dimensions and a function with a 4-element vector input. I want to apply my function to give me an mxnx4 output, such that the function is applied mxn times (i.e. the 3rd ...
0
votes
2answers
45 views

Ordering an array with the smallest value first MATLAB [duplicate]

I'm trying to get the smallest value in the 2D array but keep the order of the 2D array, for example: If I had the array 7 | 72 | 38 | 03 | 75 | 5I want to order it so it ...
0
votes
2answers
39 views

Find indices of unordered pairs of rows satisfying some constraints

I have two vectors U1 and U2 in Matlab of dimension 9x1 both listing the integers from 1 to 9.clearU1=(1:1:9).';U2=U1;I then construct the vector U of size (9*9)x1 by taking the Cartesian ...
2
votes
2answers
56 views

Matrix transformation in MATLAB

For example, I have a matrix A (Figure 1). When the variable n=2, I want it to be transformed to the matrix B. The red rectangle shows the transformation rule of every column. According to this ...
0
votes
1answer
23 views

From vector to matrix reshape every ith rows for each column

I have this vector:arr=[1; 2; 3; 1; 2; 3; 1; 2; 3; 1; 2; 3]And would like to turn it into a 4x3 matrix looking like this:mat=[1 1 1;...2 2 2;...3 3 3;...1 1 1;...2 2 2;...3 3 3;...1 1 ...
0
votes
0answers
20 views

MATLAB - Correction based on multiple condition. Help to speed up a function

I need help to speed up a function I created to correct x and y elements based on the position of obstacles.I explain better my function with one example only in the x direction (this means 1D ...

153050per page