Answered
adding values to vector
unique(v,'rows') %Or maybe you want something like this: v=[4 15; 3 15] c=[3 15] if ismember(c,v,'rows') ...

11 years ago | 0

| accepted

Answered
Matlab 2014b: Copying just the legend from existing figure into subplot
h1 = hgload('file.fig'); leg_ax = findobj(h1,'type','axes','Tag','legend','-not','Tag','Colorbar'); figure s6 = subplot(2,3...

11 years ago | 0

Answered
Extract values above another value in a matrix
A(A>5)

11 years ago | 1

| accepted

Answered
how can i assign a column in a cell array -a vector
M=rand(4,8) % Example out=num2cell(M,2)' %If you want to do it with your for loop, use curly bracket |C{1,i}=v;| or |C(1,...

11 years ago | 0

| accepted

Answered
create random matrix with 4 vectors
a=[1 0 0; 0 1 0;0 0 1] x=5 y=4 z=7 n=x+y+z b=zeros(n,3) ii1=randperm(n,x) b(ii1,:)=repmat(a(1,:),x,1) ii=setdiff(1:n,i...

11 years ago | 0

| accepted

Answered
Ylim on plotyy - setting min value but leaving max automatic
set(AX1(1),'YLim',[0 inf],'FontSize',10);

11 years ago | 0

| accepted

Answered
Finding the minimum value of each row of a matrix
Just change the place of fprintf in your code mat=[11 11 2 3; 5 2 6 9] [m,n] = size(mat); for i = 1:m; mvec = mat(i,:); ...

11 years ago | 0

| accepted

Answered
Comparing two arrays of different length
A=[11 11 2 3; 5 2 6 9] B=[11 3; 2 9] idx=find(ismember(A',B','rows'))

11 years ago | 4

Answered
How do I use the "find" command to replace all values in a vector that meet a certain condition?
You don't need find function v=[2 10 0 4 -2 7 -1 3 6 9] v(v>3)=3 with find v(find(v>3))=3

11 years ago | 1

| accepted

Answered
How do i write something like this 10100 as bits to a file ?
a={' ' 5 '00' 'E' 5 '010' 'T' 5 '011' 'R' 3 '100' 'A' 2 '1010' 'I' 2 '1011' 'N' 2 '1100' '.' 1 '11010' 'B' 1 '11011' ...

11 years ago | 0

Answered
Logical indexing when index exceeds matrix dimensions
Now try this example x = randi([1 2], 10, 1) x(5:10)= 100 % intentionally change few elements idx = x>2 % index x>2 x(i...

11 years ago | 0

Answered
Sum of index elements
A=rand(4,5); [n,m]=size(A) B=rand(n,m) C=rand(n,m) D=rand(n,m) G=zeros(n,m) idx1=A < 0.25 G(idx1) = B(idx1) + C(...

11 years ago | 0

| accepted

Answered
Can I create a matrix with unknown dimension ?
If you want to pre-allocate just set your matrix to A=zeros(n,m) nxm is the biggest dimension you are expecting

11 years ago | 0

Answered
Undefined function or method 'H' for input arguments of type 'double'.
u is not defined. x_1=linspace(-1,1,5); y_1=linspace(-1,1,5); z=0.5; L1=0.5; lambda=1030e-9; k=2*pi/lambda; w0=0.1; ...

11 years ago | 0

Answered
how can i get transferfunction for 4th order state equations
You can use inv function inv(A) But what this has to do with state space representation?

11 years ago | 0

Answered
How to use num2str?
['x-' num2str(j) '.^2+ (y-0.5).^2<0.1^2,' 'x,' 'y,' 'z'];

11 years ago | 0

| accepted

Answered
summation of 2 separate matrix
x=[1 2 3 4 ]; y=[5 23 44 14]; out=sum(x.*y.^2)

11 years ago | 0

| accepted

Answered
vectorized code to make square matrix from nxm matrix
min(size(A))

11 years ago | 0

| accepted

Answered
How to find the location of values in larger arrays where the value to the right is greater
out=[diff(a,[],2) zeros(size(a,1),1)]>0

11 years ago | 1

Answered
Find the common number in rows?
A = [1 2 3; 1 4 6; 7 8 1; 6 3 1]; [ii,jj,kk]=unique(sort(A,2)) setdiff(ii,ii(histc(kk,1:numel(ii))==size(A,1))) Or ...

11 years ago | 0

| accepted

Answered
Find the common number in rows?
A = [1 2 3; 1 4 6; 7 8 1; 6 3 1] B=A(2:end,:); idx=arrayfun(@(x) all(any(ismember(B,x),2)),A(1,:)) out=setdiff(unique(B),A...

11 years ago | 0

Answered
Storing an equation then change one variable repeat transfer function
save your expression in an m-file

11 years ago | 1

Answered
Comparing values within two vectors
A = randi(25,372,1); B=1:25; [ ~,jj]=ismember(A,B)

11 years ago | 1

Answered
How to sum up of sum unique arrays in a matrix
[ii,jj,kk]=unique(a(:,1)) out=[ii cell2mat(accumarray(kk,1:numel(kk), [],@(x) {sum(a(x,2:end),1)}))]

11 years ago | 0

| accepted

Answered
How to use default values with deal()?
parameters = [1 2]; temp_param = num2cell(parameters) temp_param(numel(temp_param)+1:3)=num2cell(zeros(1,3-numel(temp_param)...

11 years ago | 1

| accepted

Answered
How do I write in a Simulink truth Table, using Matlab script?
You can use <http://www.mathworks.com/help/simulink/slref/set_param.html set_param function>. Use also get_param to get the diff...

11 years ago | 0

| accepted

Answered
Sum of subsets /= sum of whole??
a_lm3 is a single array, if you want to get the same result ba_lm3=double(ba_lm3); a=ba_lm3(:,1:72,:); b=ba_lm3(:,73:144,...

11 years ago | 1

| accepted

Answered
How to compare rows in same matrix
[x,idx]=unique(cord,'rows')

11 years ago | 0

| accepted

Answered
How to speed up this code?
[~,idx]=min(abs(someVector - someScalar))

11 years ago | 0

| accepted

Answered
Sorting rows - case insensitive?
A={'Happy' 'the' 'man' 'and' 'happy' 'he' 'alone'} [~,idx]=sort(upper(A)) out=A(idx)

11 years ago | 4

Load more