Réponse apportée
Plotting exponential curves with random numbers.
Here is something to get you started x = linspace(-10,10,100) ; hold on % help! for k = 1:5, B = 0.15 + (0...

plus de 12 ans il y a | 0

Réponse apportée
How to plot number of box plots in a single figure? each box plot is a verctor of variable length.
Here is an example. % Given two column vectors with different lengths V1 = 5 + 10 * randn(7,1) ; V2 = 10 ...

plus de 12 ans il y a | 0

Réponse apportée
How to determine samplenumber for fixed distance-intervals?
For examples, I prefer integers, so I upscaled everything by a factor 10. % your data M = [0 1 4 6 8 10 12 14 16 17 18 1...

plus de 12 ans il y a | 0

| A accepté

Réponse apportée
Unsure of how to use and understand rand function
It is always insightful to look at a smaller example: A = [ 4 2 3 1 ; 5 4 2 3 ; 6 7 8 9 ; 1 4 2 5] % just 2-by-2 instead of...

plus de 12 ans il y a | 0

Réponse apportée
IF / ELSE Usage within For loop for Specific Iteration Only
As a follow-up, if you only need to perform the statements within a for-loop when the iterator takes specific values, you can ch...

plus de 12 ans il y a | 1

Réponse apportée
Do while loop in Matlab
A do-while loop in disguise: while true % statements here % if ~WhileCondition, break ; end end or

plus de 12 ans il y a | 22

Réponse apportée
How to replace element matrix with the other matrix?
Even simpler: % example data A = 99 * ones(2,2) B = -1 * ones(6,8) % engine szA = size(A) i0 = (size(B)-sz...

plus de 12 ans il y a | 0

Réponse apportée
How to replace element matrix with the other matrix?
To replace the central portion of B with A try this % example data A = 2 * ones(2,2) B = -3 * ones(6,8) % eng...

plus de 12 ans il y a | 0

Réponse apportée
Including comments in a .mat file?
Another option might be to use a structure: A.values = [21 22 35] A.label = 'temperature' A.unit = 'degrees Cels...

plus de 12 ans il y a | 1

Réponse apportée
Fast matrix multiplication in loop
Two options: 1. *pre-allocate* C to avoid memory allocation in each iteration C = zeros(N, ..) % pre-allocation for ...

plus de 12 ans il y a | 0

Réponse apportée
i want all the combinations for [abc]...like abc, ab, ac, bc, a, b, c. can anyone help..Plz...
Take a look at my NCHOOSE function on the File Exchange as it does exactly what you're after. S = nchoose('abc') % S = {...

plus de 12 ans il y a | 3

Réponse apportée
How to replace element matrix with the other matrix?
I suggest that you give *a smaller example of A and B* and the required output.

plus de 12 ans il y a | 0

Réponse apportée
Help with linear fit
Here's how: tf = x > x1 & x < x2 % true for x1 < x < x2 p = polyfit(x(tf), y(tf),1) % fit on selection

plus de 12 ans il y a | 0

Réponse apportée
Finding Consecutive True Values in a Vector
Hide the loops ;-) input = [1 0 1 1 0 0 1 1 1 0 1 0 1 1 1 1 0] [~,~,C] = logicalfind(input,1) ; C = cellfun(@cums...

plus de 12 ans il y a | 0

Réponse apportée
use of conditional statement
Here is an example to obtain low intensities. It is often handy to keep the original format and set the elements you are not int...

plus de 12 ans il y a | 0

| A accepté

Réponse apportée
discrete value to binary value
what are discrete values? integers in decimal notation? help dec2bin dec2bin(9)

plus de 12 ans il y a | 0

| A accepté

Réponse apportée
Out of memory error in combination combnk
*Questions* # Do you need them all 1.2652e14 at the same time? (Impossible!) # Do you need only a random fraction of these? ...

plus de 12 ans il y a | 1

Réponse apportée
Adding noise with certain standard deviation to uncorrupted data
In addition to Wayne's suggestion you can sample noise from any distribution with unknown parameters and set the standard deviat...

plus de 12 ans il y a | 2

Réponse apportée
Import excel file with comma for decimal and dates
In excel and/or in Windows System settings (i do not know where) change the settings of the decimal notation to dot and to the r...

plus de 12 ans il y a | 1

Réponse apportée
please help me sort this out
When column number does matter: % A : a N-by-M array % B : a 1-by-N row vector [~, ii] = max(sum(bsxfun(@eq,A,B),2)) ...

plus de 12 ans il y a | 1

Réponse apportée
Why the preallocated matrix perform slower in the case below?
You are not doing the same thing, as it takes time to evaluate the indices into ZZn, as well as temporary memory to store them. ...

plus de 12 ans il y a | 0

Réponse apportée
Random Binary Sequence Generator
Here are two suggestions: % with 0 <= P <=1 RBS = rand(1,N) < P % will give roughly a proportion of P ones among ...

plus de 12 ans il y a | 1

Réponse apportée
concatenate each element of two arrays
A=['a' 'b' 'c'] B = ['1' '2'] C = allcomb(A,B) ALLCOMB can be found here: http://www.mathworks.com/matlabcentral/f...

plus de 12 ans il y a | 1

Réponse apportée
How i use a variable name to do a fid=fopen?
Create a function m-file, where you can use a variable. function MyProgram (MyInputFile) % MYPROGRAM (FILE) opens the ...

plus de 12 ans il y a | 0

Réponse apportée
Finding values in an Array
Apply some arithmetic: Subject = [126 156 1992 203 186 10 100 100000] Group = fix(Subject ./ (10.^floor(log10(Subject)...

plus de 12 ans il y a | 1

| A accepté

A soumis


LOGICALFIND
Find occurrences of consecutive non-zeros in a vector (v1.0, jan 2014)

plus de 12 ans il y a | 1 téléchargement |

5.0 / 5

Réponse apportée
Can you help me solving that?
No need for an explicit loop as you can exploit the power of MatLab with *BSXFUN*. % example data A =[1 2 3 4 5 6 7 ...

plus de 12 ans il y a | 0

Réponse apportée
Matrix Multiplications (Altar Output Matrix Size)
Your question is a little confusing. Do you intend to do element-by-element multiplication or matrix multiplication? Assuming...

plus de 12 ans il y a | 0

Réponse apportée
change values in a matrix
Another problem needs another solution: a = [0.1234 -1.9876 -2.0001 22.9999] b = a % work on a copy q = ...

plus de 12 ans il y a | 0

| A accepté

Réponse apportée
How does command STEM work for complex numbers?
STEM uses PLOT to make its lines. The documentation of PLOT is clear on complex numbers: _PLOT(Y) plots the columns of Y vers...

plus de 12 ans il y a | 0

Charger plus