Réponse apportée
generation of random numbers inthe specified range ?
your_vals = 8.75 + (9.50 - 8.75).*rand(100,1);

plus de 13 ans il y a | 0

Réponse apportée
Figures displaying differently in and out of MATLAB
In order to preserve appearance, you could use a vector graphics format, such as .svg or .eps, instead of .png which is a bitmap...

plus de 13 ans il y a | 1

| A accepté

Réponse apportée
Ploting A square around minima of a matrix
x = rand(100,1); y = rand(100,1) [idx idx] = min(y); plot(x,y,'.') hold on; plot(x(idx),y(idx),'s','MarkerSize'...

plus de 13 ans il y a | 0

Réponse apportée
decrease num of for loops
old_v = 0; for ii = 1:8*8*8*8 [u v x y] = ind2sub([8 8 8 8],ii); u = u-1; v = v-1; x = x-1; y = y-1; ...

plus de 13 ans il y a | 0

Réponse apportée
Run an M-file multiple times
for ii=1:1000 your_m_file_name %the .m is not necessary end Provided you are in the directory your m-file resides...

plus de 13 ans il y a | 0

| A accepté

Réponse apportée
Problem when assigning vectors
b = zeros(numel(f),1);

plus de 13 ans il y a | 1

Réponse apportée
need a time series
totHours = 72; totMin = 12; totSec = 21; totVals = totHours*60*60+totMin*60+totSec; hour_vec = cell2mat(arra...

plus de 13 ans il y a | 3

| A accepté

Réponse apportée
Weird spaces undetected by strfind
This sounds like an encoding problem. To find out what encoding your installation of Matlab uses: feature('DefaultCharacte...

plus de 13 ans il y a | 2

Réponse apportée
Generate random's number?
nVals = numel(your_stream); your_val = your_stream(randperm(nVals,1));

plus de 13 ans il y a | 1

Réponse apportée
How to compare a matrix row by row with specified condition
Maybe not the most efficient thing around, but here goes: A=[ 5 0 10 15 0.021 5 0 15 20 0.011 10 15 ...

plus de 13 ans il y a | 0

| A accepté

Réponse apportée
How to output as a vector
Still <http://www.mathworks.com/matlabcentral/answers/51950-coin-toss-game-simulation going at it>. What's the meaning of _N ...

plus de 13 ans il y a | 0

| A accepté

Réponse apportée
datenum with time in time vector
I don't think you get the same number. Try diff(tt) and you will see that they are different. Also, use f...

plus de 13 ans il y a | 0

| A accepté

Réponse apportée
transform a cell in a column
A = cell2mat(A);

plus de 13 ans il y a | 0

Réponse apportée
How to plot multiple qqplot (Observed vs. Simulations) on same single figure with same regression line?
You can't. Why would you want to do that? Even if you could, what would the meaning be? It's not a regression line. A straight l...

plus de 13 ans il y a | 0

| A accepté

Réponse apportée
Can these operations be vectorized?
There are ways, but it will probably be slower. For loops are not necessarily bad. Look at the answer <http://www.mathworks.com/...

plus de 13 ans il y a | 0

Réponse apportée
what kind function of this? Fit Constant Probability?
_constProb_ is not a built-in function. You can look at the source code yourself edit constProb Or you can post it her...

plus de 13 ans il y a | 1

| A accepté

Réponse apportée
how to add string matrix to numeric matrix?
You could use cell arrays: a={'rice';'corn';'wheat'}; b={3;4;3}; your_result = cellfun(@(a,b) [a ' ' num2str(b)],a,b,...

plus de 13 ans il y a | 0

Réponse apportée
systematic: Do not use global, don't use eval
In small programs it's not a problem. If you are the only one that will be ever using your code, it should not be a problem. It ...

plus de 13 ans il y a | 3

Réponse apportée
Returning which button was pressed.
f = figure(1); click_type=get(f,'SelectionType'); if strcmp(click_type,'normal') %right click %Do some stuff el...

plus de 13 ans il y a | 0

| A accepté

Réponse apportée
How can I select all the nonzero elements of a matrix and give out a matrix?
your_mat = A(A~=0); And if you want a sparse matrix: your_mat = sparse(A);

plus de 13 ans il y a | 0

Réponse apportée
numerical stable triangulation method?
# No. Both are valid Delaunay triangulations. # None, unless you write it yourself. You could always try the file exchange, may...

plus de 13 ans il y a | 0

| A accepté

Réponse apportée
Is there something wrong with the find function?
From the documentation on the colon operator: j:i:k is the same as [j,j+i,j+2i, ...,j+m*i] In your vector _0.2_ would b...

plus de 13 ans il y a | 1

| A accepté

Réponse apportée
Conversion from uint8 to ascii to number
Somewhat convoluted, depends on whether you can use _sprintf()_ and _sscanf()_: your_ascii = [48 46 56 52]; your_asci...

plus de 13 ans il y a | 0

Réponse apportée
Coin toss game simulation.
num_toss = 10; %Toss the coin vec_toss = rand(num_toss,1) > 0.5; %Get the average: mean_vec = cumsum(vec_toss)./(1...

plus de 13 ans il y a | 0

| A accepté

Réponse apportée
Correct plot in matlab
Try: plot(Shear(:,1),Shear(:,2)); If you give a matrix as an argument to _plot()_ it will draw each column as independ...

plus de 13 ans il y a | 0

Réponse apportée
how can store two power 1000 value in matlab.
<http://en.wikipedia.org/wiki/Integer_(computer_science) You can't.>

plus de 13 ans il y a | 0

Réponse apportée
How can I use an return value from function1 in function2 (different m.files)?
You need to pass returnval1 to fun2: function returnval1 = fun1(input1,input2,input3) %do your stuff function f...

plus de 13 ans il y a | 0

Réponse apportée
What can I do to large scale array?
There are two limiters: data type and addressable memory. The data type will affect how much memory is needed. It can be solved ...

plus de 13 ans il y a | 0

| A accepté

Réponse apportée
How do I create a create 'for' loop to compute time, position, velocity and add to running sum?
Indexes in Matlab start with one, not zero. _which_ever_array(0)_ will return an error. In your example, you could, amongst oth...

plus de 13 ans il y a | 0

Réponse apportée
Draw uninterrupted lines on a plot with missing values
idx = ~any(isnan(y),1); plot(x(idx),y(idx)); Also, you could use _nanmean()_ to get the mean in the presence of NaN'...

plus de 13 ans il y a | 2

| A accepté

Charger plus