Question


apply a function to every element of a square matrix
I have a square matrix and I would apply a function to every element of that matrix in the way I get a new square matrix where e...

ungefär 12 år ago | 3 answers | 0

3

answers

Question


building a matrix starting from another matrix
I want to build a square matrix. Let's suppose We have this matrix called nodes 1 4.3434 3.4565 2 6.2234 5.1234 3 1...

ungefär 12 år ago | 1 answer | 0

1

answer

Question


indexing a square matrix in the best possible way
I have a square matrix and I would check some condition of every element of it.which could be the best way to indexing a square ...

ungefär 12 år ago | 3 answers | 0

3

answers

Question


fill a vector inside a cycle
I have a script where I have to fill a vector like this example: heads = (1:10); vector_to_fill = zeros(1,5); for i...

ungefär 12 år ago | 1 answer | 0

1

answer

Question


how preallocate structure for better memory
I had created a structure made so: head.number = 3; head.pck_rcv = [1 0 0]; heads(2).number = 5; head(2).pck_r...

ungefär 12 år ago | 3 answers | 2

3

answers

Question


store values in a certain way
I would store values in a certain way like this: For example I have values as [2 3] to this values I would connect to 2 a vec...

ungefär 12 år ago | 1 answer | 0

1

answer

Question


preallocate vector or not
I'm doing a simulation and I initialize a vector that will contain during the simulation integer values. At the beginning I don'...

ungefär 12 år ago | 3 answers | 0

3

answers

Question


find index of a matrix through another matrix
I have this matrix A = [1 3 4 6 7] and B = [3 4] that it's a subset of A matrix. For example I would find the index of B matrix ...

ungefär 12 år ago | 3 answers | 0

3

answers

Question


same values using randi setting seed as default
I'm using randi to generate rand integer valeus but I get the same values two times in my vector. example rng default; f...

ungefär 12 år ago | 5 answers | 0

5

answers

Question


enter in the if clause only in certain situation
I would execute a block only if I have this vector A=[1 0] instead if I'd have A=[0 0] or A=[1 1] if clause shouldn't be...

ungefär 12 år ago | 1 answer | 0

1

answer

Question


how to create while statement
I'd create while statement that should works like: A is an column vector while [every A element is not equals to 1] ...

ungefär 12 år ago | 1 answer | 0

1

answer

Question


there is a way that if clause it is execute
Here it is a piece of code: x = rand; if x < 1E-6 do-something end if I execute this piece of block in l...

ungefär 12 år ago | 1 answer | 0

1

answer

Question


find if a column vector contains at least element 1
I have to check if column vector has at least element 1. Does Matlab have such similar function or I have to build it myself?

ungefär 12 år ago | 2 answers | 0

2

answers

Question


rand integer values from an array
I have an array that contains some integer. i.e A=[1 5 7 9] I would choose a rand value from this vector. Which cou...

ungefär 12 år ago | 1 answer | 0

1

answer

Question


best way to enter only one time in a if block
I have a for cycle for n= 1: 100 x=rand()*10; if x > 5 do something end end When I exec...

ungefär 12 år ago | 1 answer | 0

1

answer

Question


obtaining values major than 10e-7
I use rand function to generate values x = rand; after that I compared generated values to 10e-7 if x > 10e-7...

ungefär 12 år ago | 1 answer | 0

1

answer

Question


Obtaining same values at avery simulation using rand function
I'm building some simulations with matlab and I use rand function. I would obtain at every run, the same results. I read somewhe...

ungefär 12 år ago | 3 answers | 0

3

answers