Réponse apportée
How do I know the frequency of each unique pair?
Here's a one-liner that works if the input is of a N-by-2 matrix with positive integers: A=uint8([1 2; 3 4;1 2;5 6;1 2;5 ...

environ 12 ans il y a | 0

Réponse apportée
Average returns for diffferent companies
Assuming DATA is a cell array holding your data, something along these lines could work: [COMPANY,~,idx] = unique(DATA(:,...

plus de 12 ans il y a | 0

Réponse apportée
converting decimal matrix to binary matrix
Do you want the output in strings, as cells, or as numbers? M = [ 1 25 34 9 ] Mstr = dec2bin(M,8) % char array M...

plus de 12 ans il y a | 0

Réponse apportée
How do I determine if a value is unique within an iteration?
Doe the array nut changes during iterations? If not, you can find the unique indices into nut using UNIQUE [~,idx] = unique...

plus de 12 ans il y a | 0

Réponse apportée
how to delete all the elements from the matrix?
Several options, depending on the desired result (same class, for instance): A = [] A(:) = [] A = zeros(0,0,class(A))...

plus de 12 ans il y a | 0

Réponse apportée
fill a range with specified color
fill([A A],[b c],'r') help fill

plus de 12 ans il y a | 0

Réponse apportée
Changing duplicates in an array to zero?
x = [1 1 6 6 3 3 2 3 4 6 6 3 3 2 2 2 3 3 3] y = zeros(size(x)) [~,i] = unique(x,'first') y(i) = x(i)

plus de 12 ans il y a | 1

Réponse apportée
Interpolation command by MATLAB
The statement "shading interp" only causes the plot to be interpolated. To obtain the values you can use INTERP, INTERP1, INTERP...

plus de 12 ans il y a | 0

Réponse apportée
Random Vectors with Fixed Sum (algorithm of Roger Stafford)
I would cite the function as a website. Something like this suffices, I think: R. Stafford (2006). RandfixedSum, Matlab File ...

plus de 12 ans il y a | 0

| A accepté

Réponse apportée
find indices of string matches from a cell array by thier endings
You can use REGEXP to find a specific string property. Moreover you can combine various properties using the separator | ...

plus de 12 ans il y a | 3

Réponse apportée
I' am facing a error"Out of memory. Type HELP MEMORY for your options."
Use less memory … This means your matrices are too large. Do you really need to keep all data in your working memory? Can you...

plus de 12 ans il y a | 0

Réponse apportée
create subarray from an given array
This problem is somewhat ill-defined. If there are multiple group sizes allowed, should all group sizes be present an equal amou...

plus de 12 ans il y a | 0

Réponse apportée
How to find frequency of occurence of a specific element in a matrix per column??
tf = A(:,1) >= 0 & A(:,1) <= 2.5 % true, when within range tmp = A(tf,3:7) N55percolumn = sum(tmp==55,1)

plus de 12 ans il y a | 0

| A accepté

Réponse apportée
sir,i want to convert string into a hexadecimal value...is there any direct command?
Do you want to convert the string to a value? STR = input('Enter a hexadecimal number:','s') % the user types, for insta...

plus de 12 ans il y a | 0

Réponse apportée
run length encoding n decoding
Did you search the file exchange? I recommend this one by Urs: <http://www.mathworks.nl/matlabcentral/fileexchange/6436-rude...

plus de 12 ans il y a | 0

Réponse apportée
Calculating the probability of one bin preceding the other
Counting can be done using ismember tf11 = ismember(A,[1 1],'rows') ; % true for rows that are [1 1] N11 = sum(tf11) % c...

plus de 12 ans il y a | 1

| A accepté

Réponse apportée
How to have a user input prompt more user inputs?
N = str2double(inputdlg('How many inputs','N')) if ~isempty(N) && ~isnan(N) && N > 0 && N < 10 % sanity check! prompt...

plus de 12 ans il y a | 0

Réponse apportée
Resizing cells in a cell array
Let C be your cell array D = C(~cellfun(@(x) size(x,1) < 50 && size(x,2) < 40,C))

plus de 12 ans il y a | 0

| A accepté

Réponse apportée
how to draw random numbers from the vector
If V is your vector of numbers, and N the number of values you want from it, there are various options: V = 1:2:20, N = 5 %...

plus de 12 ans il y a | 2

| A accepté

Réponse apportée
Given a matrix A, and a matrix of column indices B, how to create a new matrix C from A and B
A = [ 5 8 3 4 8 1 9 6 8 ] B = [3 1 2 2 3 1 1 3 2] % B is an array of column indices % create the ...

plus de 12 ans il y a | 0

| A accepté

Réponse apportée
how to skip incomplete and missing lines when reading from Text file?
Empty lines are skipped. The real trouble is reading the incomplete lines. I suggest to read each line in as a string, and then...

plus de 12 ans il y a | 0

Réponse apportée
How can I delete rows in a matrix where two numbers exist side-by-side?
A = [2,7,3;1, 2, 1; 1, 2, 1; 2, 2, 3; 1, 2, 1; 2, 3, 4] i = 1:size(A,2)-1 tf = A(:,i)==2 & A(:,i+1)==3 % tr...

plus de 12 ans il y a | 0

Réponse apportée
How can I convert A matrix to B matrix below?
B = eye(size(A)).*A B = cumsum(B,1) + cumsum(B,2) - B

plus de 12 ans il y a | 1

| A accepté

Réponse apportée
matrix generation 1 to n*n or interval
reshape(1:n^2,n,n).'

plus de 12 ans il y a | 1

| A accepté

Réponse apportée
how to find correlation coefficient?
a = a(:) % transform into vectors b = b(:) plot(a, b, 'b.') xlabel('Value of a') ; ylabel('Value of b') ; lslin...

plus de 12 ans il y a | 0

Réponse apportée
Grid line for x=0 and y=0
Take a look at GRIDXY, available on the File Exchange: <http://www.mathworks.com/matlabcentral/fileexchange/9973-gridxy-v2-2-...

plus de 12 ans il y a | 0

Réponse apportée
How can I create an array of fixed length?
Maybe you want to pre-allocate z and c like this: z = zeros(size(z0)) ; c = zeros(size(z0)) ;

plus de 12 ans il y a | 0

| A accepté

Réponse apportée
Finding Sequences of 1's values
Another idea, not tested for speed: A = [0 0 0 0 0 0 1 1 1 0 0 0 0 0 1 1 0 0 0 0 1 1 1 1 1 0 0] B = cumsum(a) tf ...

plus de 12 ans il y a | 0

Réponse apportée
problem with the setdiff function
A = 2:.1:15 B = [9.4000 10.4000] D = 2 ; % number of digits that should match (e.g. 1.231 = 1.229) C = setdif...

plus de 12 ans il y a | 0

Réponse apportée
'rotating' matrix data around one point
You can use CIRCSHIFT to move the a point to the centre of the matrix, and then apply ROT90 to rotate it, and apply CIRCSHIFT ag...

plus de 12 ans il y a | 0

Charger plus