Respondida
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...

más de 12 años hace | 0

Respondida
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 ...

más de 12 años hace | 0

Respondida
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...

más de 12 años hace | 0

| aceptada

Respondida
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...

más de 12 años hace | 0

Respondida
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...

más de 12 años hace | 1

Respondida
Do while loop in Matlab
A do-while loop in disguise: while true % statements here % if ~WhileCondition, break ; end end or

más de 12 años hace | 22

Respondida
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...

más de 12 años hace | 0

Respondida
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...

más de 12 años hace | 0

Respondida
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...

más de 12 años hace | 1

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

más de 12 años hace | 0

Respondida
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 = {...

más de 12 años hace | 3

Respondida
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.

más de 12 años hace | 0

Respondida
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

más de 12 años hace | 0

Respondida
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...

más de 12 años hace | 0

Respondida
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...

más de 12 años hace | 0

| aceptada

Respondida
discrete value to binary value
what are discrete values? integers in decimal notation? help dec2bin dec2bin(9)

más de 12 años hace | 0

| aceptada

Respondida
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? ...

más de 12 años hace | 1

Respondida
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...

más de 12 años hace | 2

Respondida
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...

más de 12 años hace | 1

Respondida
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)) ...

más de 12 años hace | 1

Respondida
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. ...

más de 12 años hace | 0

Respondida
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 ...

más de 12 años hace | 1

Respondida
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...

más de 12 años hace | 1

Respondida
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 ...

más de 12 años hace | 0

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

más de 12 años hace | 1

| aceptada

Enviada


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

más de 12 años hace | 1 descarga |

5.0 / 5

Respondida
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 ...

más de 12 años hace | 0

Respondida
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...

más de 12 años hace | 0

Respondida
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 = ...

más de 12 años hace | 0

| aceptada

Respondida
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...

más de 12 años hace | 0

Cargar más