Answered
How to select specific values from a matrix?
%Example a=[1;1;1;2;2;3;3;3;3;4;1;2;4] b=randi(9,numel(a),3) c=[a b]; %------------------The code---------------- y=accum...

11 years ago | 0

Answered
Undefined function or method 'fOpen' for input arguments of type 'char'
It's not fOpen, it's fopen

11 years ago | 0

Answered
How to find two continuous words appear in the sentence
idx=find(~cellfun(@isempty,regexp(A,'is good','match')))

11 years ago | 0

Answered
How can I generate a random vector between 1-9 with 10 numbers and at least one number should be >2.
X=rand(10,1)*8+1; idx=X>2; if nnz(idx)==0 X(randi(numel(X)))=7*rand+2; end

11 years ago | 0

Answered
How to store all loop results? how can i solve this problem??
k=0; for i=1:4 for j=2:5 if i<j k=k+1; ind(k,1:2)=[i,j] end end end ...

11 years ago | 0

| accepted

Answered
how to convert discrete to continuous domain using c2d and using for loop for Ts=sampling period
%Example model1=tf(1,[1 1]) Ts=[0.01 0.05 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1] for k=1:numel(Ts) dmodel{k}=c2d(model...

11 years ago | 0

Answered
How to make 'solve' work?
solve('cos(x/50)-1/sqrt(2)==10^(-3)')

11 years ago | 0

Answered
changing a loop to a function
function s=yourfunction(q,kevin) for x = 1:100 for y = 1:61 b = abs(bsxfun(@minus,q{x},kevin)) ...

11 years ago | 0

| accepted

Answered
red dotted wire instead of solid black wire problem in simulink
Red dotted lines means you can't connect these blocks. Read this link <http://www.mathworks.com/matlabcentral/answers/14998#answ...

11 years ago | 0

Answered
How to concatenate string vectors of unequal length?
v1 = {'a' 'b' 'c'}', v2 = {'d'}' v3 = {'e' 'f'}' v=cell(3,3) v(:,:)={' '} v(1:3,1)=v1 v(1,2)=v2 v(1:2,3)=v3

11 years ago | 1

Answered
Change string of text into multiple lines
s=',1,1880802442166,1,751702411341,1,751702411358,1,751702411365,1,751702411372,1,751702411389,1,751702459060,1,751702459077,1...

11 years ago | 1

| accepted

Answered
tables/matrix with characters and numbers
countrie={'Italy' 'USA' 'UK'}' animal={'Cats' 'Dog' 'M'}' v1=[100 30 10]' v2=[2 4 0]' t=table(countrie,v1,animal,v2) ...

11 years ago | 0

Answered
How can I find the roots of a symbolic polynimial
use sym2poly instead of coeffs syms s aa=- 30*s^4 + 300*s^3 b=sym2poly(aa) If you want another order c=fliplr(b)

11 years ago | 1

Answered
Checking the repeated values, add them and find mean
A=[44128 162 54960 150 58320 119 31200 120 48240 180 54960 1...

11 years ago | 0

Answered
Count the index of the array
If your array doesn't contain negative numbers a=[0 0 0 0 0 0 0 0 0 10 0 0 0 0 15 0 17] out=nnz(a)

11 years ago | 1

| accepted

Answered
exist() for functions only?
exist()==2 %or A = exist('name','file')

11 years ago | 0

Answered
How to make string from matrix?
A=magic(4) B=[num2cell(A');repmat({'#'},1,size(A,1))] out=strjoin(cellfun(@num2str,B(:)','un',0))

11 years ago | 0

| accepted

Answered
Superimpose matrices of different sizes
*EDIT* C=A B(B==0)=nan C(1:size(B,1),1:size(B,2))=B %or A=nan(2,5) B=[NaN 6 2;NaN 1 0] x=B>0; [ii,jj]=find(x) ...

11 years ago | 0

| accepted

Answered
Determining the intersection of two vectors
line1 and line2 are two arrays, C = intersect(line1,line2) will return the common elements to the two arrays

11 years ago | 1

Answered
Usage Of "goto" for previous lines
Insert this code test=1; while test==1 y(i+1)=y(i)+(0.5*h*(Y(i)+Z(i+1))) Y(i+1)=x(i+1)+y(i+1) i...

11 years ago | 0

| accepted

Answered
hi i need instruction or function to return locaition of pixel
You can use find function

11 years ago | 0

Answered
Undefined function or method 'ge' for input arguments of type 'struct'.
A=load('A') A=cell2mat(struct2cell(A)) %or q=fieldnames(A) out=A.(q{1})

11 years ago | 0

| accepted

Answered
checking and generating fix length value
a=83 b=num2str(a) out=[repmat('0',1,4-numel(b)) b]

11 years ago | 0

Answered
How to get sum of all the order values for a given id of a column in matrix
A=[1 10;2 29;2 34;2 79;3 11;3 20;3 11;4 9;4 1;5 10] out=[unique(A(:,1)) accumarray(A(:,1),A(:,2...

11 years ago | 0

| accepted

Answered
How to let the matlab to remember the previous directory?
Create a cell array where you can store your directories

11 years ago | 0

Answered
Remove element from cell array completely
handles.guideGUI(cellfun('isempty',handles.guideGUI))=[]

11 years ago | 1

Answered
A Problem with log10
Try this clear log10 U=zeros(2030,1354); for j=1:1354 for i=1:2030 U(i,j)=R547(i,j)/R531(i,j); end...

11 years ago | 1

Answered
How to store cell array or data in the GUI?
Use <http://it.mathworks.com/help/matlab/ref/guidata.html guidata>

11 years ago | 0

| accepted

Answered
How to change line style of a plotted graph?
If we test this example plot(1:44) hline = findobj(gcf, 'type', 'line') set(hline(1),'LineStyle','--') It seems to wo...

11 years ago | 3

| accepted

Answered
Persistent variables not working? (Simulink)
currentX is not defined in your code

11 years ago | 1

Load more