답변 있음
Why didn't this 'try.. catch' work?
You should read the documentation of input which says: " _If the user enters an invalid expression at the prompt, then MATLAB...

거의 10년 전 | 1

답변 있음
Generate matrix of a random process with each row using different parameters and no for-loop
mu = [0, 3, 2, 5, 1] sigma = [1, 5, 4, 10, 7] MyDistributions = cell2mat(arrayfun(@(k) random('norm', mu(k), sigma(k), [...

거의 10년 전 | 0

답변 있음
How to remove the rows with particular value in a cell?
a = 'unknown', b = [], c = 1, d= 1:10, e ={'cell_in_cell'}, f.x = 'struct' A = { a 99 8.5; b 2.4 9.7; c 12 99; d 13 11; e...

거의 10년 전 | 0

| 수락됨

답변 있음
Is there a way for breaking a loop iteration, if it takes to long?
You can create a timer ; th = timer('TimerFcn','keyboard') ; th.StartDelay = 5 ; start(th) ; pause ; % will be...

거의 10년 전 | 0

답변 있음
How can add the rows in n-by-m matrix that have the same indicator in the last column?
X = [253638 3309 2 223389 3309 2 255968 3309 2 243943 33309 2 245568 63309 1 242490 93309 3 268464 23309 2 ...

거의 10년 전 | 0

| 수락됨

답변 있음
how to convert yymmdd to dd/mm/yyyy
A = {'750525','780215'} B = cellstr(datestr(datenum(A,'yymmdd'),'dd/mm/yyyy'))

거의 10년 전 | 2

| 수락됨

답변 있음
Binning data from two columns using one column as category for second column
[~,i] = histc(X,edges) Result = accumarray(Y,i,[max(i) 1],@sum)

거의 10년 전 | 0

답변 있음
Newbie question about table indexing,loops and logical arguments (should be easy)
I am not sure how you store your data. Here is an example with a cell array X = {'A','','','B','B','','C','C',''} Y = [1...

거의 10년 전 | 1

답변 있음
Remplace nargchk by nargincheck problem
Just use narginchk(inmin,inmax) No need for using error.

거의 10년 전 | 2

| 수락됨

답변 있음
concatenate a vector in column-major order
X = randi(20,6,4) [ii,jj] = ndgrid(1:size(X,1), 1:size(X,2)) tf = X < ii.*jj ii(tf) jj(tf)

거의 10년 전 | 0

답변 있음
How do I find the submatrix of a matrix?
Here is a simple for-loop that would work for 2D cases A = magic(6) B = A(2:3,4:5) % engine szA = size(A) ; ...

거의 10년 전 | 1

| 수락됨

답변 있음
how to find index of nx2 matrix by comparing elements
A=[ 222,186; 222,187; 223,187] i = 222 j = 187 % two alternatives r1 = find(A(:,1)==i & A(:,2)==...

거의 10년 전 | 0

| 수락됨

답변 있음
How to end ginput?
* Press <enter> * try, xy = ginput, catch end

거의 10년 전 | 0

| 수락됨

답변 있음
fill a matrix, with other matrix
A smaller example, but you should be able to get this working in your case: M = [1 0 1 1 ; 0 1 0 1 ; 1 1 1 0 ; 0 0 1 0] ...

거의 10년 전 | 0

| 수락됨

답변 있음
swap x and y axis in a matrix
M = [1 10 ; 2 20 ; 3 30] Mnew = M(:,[2 1]) % by far the easiest New = fliplr(M)

거의 10년 전 | 1

| 수락됨

답변 있음
how to generate all possible combination from a sequence
I just submitted NEXTPERM <http://uk.mathworks.com/matlabcentral/fileexchange/57429-nextperm>

거의 10년 전 | 1

답변 있음
Ylabel FontSize setting for existing plot/subplots or figures
ah = findobj(gcf,'Type','Axes') % handles to all the axes in the current figure lh = get(ah,{'ylabel','xlabel'}) % hand...

거의 10년 전 | 1

| 수락됨

답변 있음
How to Split numbers into matrix
You should update the index i inside your while, if loop. Also you now only store the first value of _valor_. raw = zeros(1...

거의 10년 전 | 0

| 수락됨

답변 있음
I can't do iterations with "while loop"....No puedo hacer iteraciones con WHILE
% initialise values here while increq > 0.001 % calculations here % update values here, including increq! end

거의 10년 전 | 0

| 수락됨

답변 있음
How do I shorten this code to remove one piece of information from each submatrix?
Using an anonymous helper function creating an inline conditional, this is doable with cellfun: % inline conditional iif...

거의 10년 전 | 0

답변 있음
Optimization of matlab code
Pre-allocate all your outputs before the loop. Distance = zeros(M,N) ... The editor should have given you a warning ...

거의 10년 전 | 0

답변 있음
removing row from a matrix, the criteria for removal being that ALL values in row must match all values in another matrix
ISMEMBER is your friend: A = [ 1 0.1; 1 0.2; 1 0.5; 2 7; 3 8; 3 0.1; 4 0.2]; B = [ 1 0.1; 2 7]; C = A(~ismember(A,...

거의 10년 전 | 0

| 수락됨

답변 있음
how to delete rows from matrix
Using the statement "test_ary(i,:) = []" you will change the size of it, which will cause problems! tf = all(test_ary==0...

거의 10년 전 | 1

답변 있음
assign vector to cell
num2cell is just the loop you wrote hidden behind a function. Nothing to gain there, I would say. Just for fun, you could als...

거의 10년 전 | 1

답변 있음
How to make moving average filter in an array with window size 100 and 50 overlapped elements?
This is not truly a moving average filter, but averaging the array by chunks. This is a nice job for arrayfun: A = rand(200...

거의 10년 전 | 0

답변 있음
Determine average of results from a loop.
This task becomes trivial when you use an array of structs rather than variable field names. for it = 1:5 info2 = ran...

거의 10년 전 | 1

| 수락됨

답변 있음
Autocorrelation function of data show now points in plot
Are there Nans in your input? A = 1:10, A(4) = NaN B = xcorr(A) % → all NaNs

거의 10년 전 | 0

답변 있음
How to reset variables before each iteration
I think I miss the point, but this will do what you are asking for: A0 = 7 ; B = 1 ; for k=1:10 % iteration ...

거의 10년 전 | 0

답변 있음
Assignment and indexing issue
x = [1 1 1 10 ; 1 1 2 20 ; 2 3 2 30] % data sz = max(x(:,1:3),[],1) d = Inf(sz) idx = sub2ind(sz,x(:,1),x(:,2),x(...

거의 10년 전 | 1

답변 있음
concatenation of array structure
An easy solution is to store each result in a cell array binaryImage = cell(n,1) ; for i = 1:2:n ... ...

거의 10년 전 | 0

| 수락됨

더 보기