Answered
Eliminate duplicates of nonzero elements but keep zeros
A = [0 1 0 1 1 0 0 0 0 0 1 1 1 0 1] A(strfind(A,[1,1]))=[]

13 years ago | 0

Answered
Going from a string to a matrix
s='january 00.0000 5.22222 6.32555 2.5548' out=regexp(s,'\s+','split')

13 years ago | 0

Answered
"Kronecker" of varying dimensions?
A=[1 2 3; 4 5 6; 7 8 9] b=[2; 1; 4] out=cell2mat(arrayfun(@(x) repmat(A(x,:),b(x),1),(1:size(A,1))','un',0))

13 years ago | 0

| accepted

Answered
How do I horizontally concatenate the following 2 numerical arrays?
ND =[58560 nan 58561 -1100 -5100 4100;58570 nan 59571 -1200 -5200 4200] OD =[58564 1 58563 11;58572 2 58573 21; 58572 2 58573...

13 years ago | 0

| accepted

Answered
How can I compare two matrices of different dimensions without looping?
C=ismember(A,B,'rows')

13 years ago | 0

| accepted

Answered
Find the last position of maximum value in a Matrix
x=[1 2 3 0 3]; [ii,jj]=max(fliplr(x)); idx=numel(x)-jj+1

13 years ago | 2

Answered
state space model has error
Your arrays are not correctly written A =[ 0, 0, 1.0, 0 0, 0, 0, 1.0 0, 0.15502416677813339370370805808099, -4.7863736679...

13 years ago | 0

Answered
Create a matrix with same diagonal elements
X=[10 20 30] n=numel(X); out=tril(cell2mat(arrayfun(@(x) circshift(X',[x 0]),0:n-1,'un',0)))

13 years ago | 0

| accepted

Answered
Discretizing a continuous state model for use in HIL
You didn't precise how you replaced the other blocks, and I don't think you are doing the right thing. You also did not give e...

13 years ago | 0

Answered
Delete the front zero elements from vector
a=[0 0 0 2 4 0 8 9 0 3] a(cumsum(abs(a))==0)=[] or a=a(find(a~=0,1):end)

13 years ago | 0

Answered
how can I change the Excel file format from matlab
[~,~,im]= xlsread('file.xls'); xlswrite('file.xlsx',im)

13 years ago | 0

| accepted

Answered
sub2ind.m -- trying to use with a 2D matrix
data(IDY) Or maybe data(IDY,:)

13 years ago | 0

Answered
How can I avoid having data proccesed in MATLAB with dots? I have to transfer the data to excel and manually replace later with commas.
a=rand(10,2) % example b=strrep(arrayfun(@num2str,a,'un',0),'.',',') xlswrite('file50.xls',b)

13 years ago | 0

Answered
need help vectorizing a loop
CorrectLogical = zeros(size(TestRan)) CorrectLogical(ismember(TestRan,CorrectVector))=1

13 years ago | 0

| accepted

Answered
Can MATLAB divide two row vectors?
a=[3 3 3] b=[4 5 6] a./b

13 years ago | 0

| accepted

Answered
How to use while loop with an inequality condition
You mean while (F<1000 && F>0.01)

13 years ago | 0

| accepted

Answered
find values around a given row value
idx=find(ismember(A,[ 2.5000 2.3500],'rows'),1) out=A(idx+1:idx+100,:)

13 years ago | 1

| accepted

Answered
how do i combine these two plots >> a = 10; >> b = 0: pi/a: 2*pi; >> plot(b,sin(b)) >> a = 10; >> b = 0: pi/a: 2*pi; plot(b,cos(b)) into one plot
a1= 10; b1=0: pi/a1: 2*pi; a2 = 10; b2= 0: pi/a2: 2*pi; plot(b1,sin(b1),b2,cos(b2)) %or plot(b1,sin(b1)) hol...

13 years ago | 0

Answered
Check for the existence of a variable inside a structure array
any(ismember(fields(data{1}),'oxy'))

13 years ago | 2

| accepted

Answered
Merge matrix to cell
A(:,:,1)=[1,1;2,2]; A(:,:,2)=[2,2;3,3]; A(:,:,3)=[3,3;4,4]; n=size(A); [ii,jj]=ind2sub(n(1:2),1:prod(n(1:2))) out=reshape...

13 years ago | 0

Answered
3-D plot in matlab
You can't use surf. Use plot3(abs(x),abs(y),abs(z)) % Generating 3D plot

13 years ago | 0

| accepted

Answered
Find local minma / opposite of findpeaks
I will tell, like you, multiply by -1 then use findpeaks

13 years ago | 4

| accepted

Answered
how to manipulate a cell
A={1800742;0;0;0;[];[];1.4400;0;0;[];0} A(cellfun('isempty',A))={'none'}

13 years ago | 0

| accepted

Answered
Every 2 rows (2x2 matrix) to perform determinant calculation
A=[1 2 ;3 4 ;5 6 ;7 8 ;9 10 ;11 12 ] B=reshape(A',2,2,[]) out=arrayfun(@(x) det(B(:,:,x)),1:size(B,3))

13 years ago | 0

Answered
could anybody help me how can I draw one complex number through a variable which is integers in (-pi, pi) interval.
If you want to represent a complex number graphically a=1+2*i scatter(real(a),imag(a))

13 years ago | 0

Answered
How to export a Matlab cell array to an Excel spreadsheet?
X=[{'A','B','C','D'};A,B,C,D] xlswrite('X.xls',X)

13 years ago | 9

| accepted

Answered
Detect of a plot is loglog
xscale=get(gca,'xscale'), yscale=get(gca,'yscale')

13 years ago | 0

| accepted

Answered
find a values in matrix
Maybe you are looking for the location H=[ 0 2.3926 2.3926 0] [ii,jj]=find(H==2.3926)

13 years ago | 0

| accepted

Load more