답변 있음
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 ...

거의 12년 전 | 0

답변 있음
Average returns for diffferent companies
Assuming DATA is a cell array holding your data, something along these lines could work: [COMPANY,~,idx] = unique(DATA(:,...

대략 12년 전 | 0

답변 있음
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...

대략 12년 전 | 0

답변 있음
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...

대략 12년 전 | 0

답변 있음
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))...

대략 12년 전 | 0

답변 있음
fill a range with specified color
fill([A A],[b c],'r') help fill

대략 12년 전 | 0

답변 있음
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)

대략 12년 전 | 1

답변 있음
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...

대략 12년 전 | 0

답변 있음
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 ...

대략 12년 전 | 0

| 수락됨

답변 있음
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 | ...

대략 12년 전 | 3

답변 있음
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...

대략 12년 전 | 0

답변 있음
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...

대략 12년 전 | 0

답변 있음
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)

대략 12년 전 | 0

| 수락됨

답변 있음
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...

대략 12년 전 | 0

답변 있음
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...

대략 12년 전 | 0

답변 있음
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...

대략 12년 전 | 1

| 수락됨

답변 있음
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...

대략 12년 전 | 0

답변 있음
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))

대략 12년 전 | 0

| 수락됨

답변 있음
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 %...

대략 12년 전 | 2

| 수락됨

답변 있음
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 ...

대략 12년 전 | 0

| 수락됨

답변 있음
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...

대략 12년 전 | 0

답변 있음
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...

대략 12년 전 | 0

답변 있음
How can I convert A matrix to B matrix below?
B = eye(size(A)).*A B = cumsum(B,1) + cumsum(B,2) - B

대략 12년 전 | 1

| 수락됨

답변 있음
matrix generation 1 to n*n or interval
reshape(1:n^2,n,n).'

대략 12년 전 | 1

| 수락됨

답변 있음
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...

대략 12년 전 | 0

답변 있음
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-...

대략 12년 전 | 0

답변 있음
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)) ;

대략 12년 전 | 0

| 수락됨

답변 있음
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 ...

대략 12년 전 | 0

답변 있음
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...

대략 12년 전 | 0

답변 있음
'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...

대략 12년 전 | 0

더 보기