Answered
deleting rows and columns
K = [1 2 3 4; 5 6 7 8; 9 10 11 12; 13 14 15 16] nr=1; nc=1; K(nr,:)=[] K(:,nc)=[] nr1=4; nc1=4; K(nr1-1,:)=[]; ...

13 years ago | 0

| accepted

Answered
Question regarding a switch statement
Example n=input('n='); switch n case 'abc' out=1 case 4 out=2 otherwise out=3 e...

13 years ago | 0

| accepted

Answered
I am hvg a program of 15 files. Each time I am running all the files to run my program. How can i make it as 1 file program?
create one m file where you will call all your m-files file1 file2 ...

13 years ago | 1

| accepted

Answered
How do I plot one timeseries vs another from the command line?
t=-10:0.1:10; x=sin(t); y=cos(t) plot(x,y)

13 years ago | 0

| accepted

Answered
How I can find the connection between two blocks of simulink from matlab?
To get the blocks that are connected to your block |block1| b=get_param('your_model/block1','PortConnectivity')

13 years ago | 1

| accepted

Answered
Save data in excel
I don't know, why you want to save them all as one vector instead a matrix 2500x500. But if you want to save your data as a vect...

13 years ago | 1

| accepted

Answered
How can I set initial values of parameters in Simulink?
Use a unit delay block and set its initial condition to what you want

13 years ago | 1

Answered
reshape many submatrices to form a new matrix
A=rand(450); ii1=1:30:450; ii2=1:30:450; [x,y]=meshgrid(ii1,ii2); B=arrayfun(@(ii,jj) reshape(A(ii:ii+29,jj:jj+29),1,[]),x...

13 years ago | 0

| accepted

Answered
AND between vectors element
A=[1 0 0 1 0 1 0 0 1 0 0 1 1 1 1 1 1 1 ] all(A,2)

13 years ago | 0

| accepted

Answered
How can I solve peak by using simulink in matlab?
In real time, you can't know if a point is a peak or no, because at t=n, we don't know the next point at t=n+1

13 years ago | 0

Answered
How to display the max values of a given interval
doc max doc min doc findpeaks

13 years ago | 1

Answered
delete null in matrix
M=[ 0 0 0 ; 7.9286 10.1000 14.3714] M=M(all(M,2),:)

13 years ago | 0

| accepted

Answered
What happens when an image is first edited in Paint and then processed in Matlab?
If im is your image, write im=im(:,:,1)

13 years ago | 0

Answered
find where a sequence of number breaks
v=[2 3 4 2 3 4 1 2 2 1 2 3 4 2 3 4 2 3 4 9 9 2 3 4 2 3 4 0 5 2 3 4 2 3 4 0] v1=num2str(v); v1=strrep(v1,' ',''); ii=rege...

13 years ago | 0

Answered
Sort values of a vector in an array according to gaps
A = [1; 2; 3; 4; 6; 7; 8; 9; 10; 12; 13; 14; 15; 16; 17; 19; 20] idx=diff(A); ii2=unique([find(idx>1) ;numel(A)]); ii1=[1 ;...

13 years ago | 0

| accepted

Answered
Creating a polyval function
Example x=0:10 If you want to calculate a polynomial |p=4x^2+2*x+5| p=[4 2 5] out=polyval(p,x)

13 years ago | 1

Answered
how to retrieve numbers from symbol?
syms x1 x2 x45; str2double(regexp(char(x45),'\d','match'))

13 years ago | 0

| accepted

Answered
How to calculate in v(k) - v(k-1) in M file
function e=fcn(v) persistent vp if isempty(vp) vp=0; end e=v-vp; vp=v;

13 years ago | 1

Answered
How can I create a new line matrix with specified value for some intervals?
[10*ones(1,3) 17*ones(1,7-4+1) 15*ones(1,10-8+1)]

13 years ago | 0

| accepted

Answered
How do I replace the elements of a matrix (x) that are more than one standard deviation (s) away from the mean (m) with the nearest of m ± s
x=rand(10) m2=mean2(x); s2=std2(x); idx1=x>m2+s2; idx2=x<m2-s2; x(idx1)=m2+s2; x(idx2)=m2-s2; x

13 years ago | 0

Answered
Selecting only some rows of a matrix
idx=A(:,1)<=1e-03 & A(:,1)>=-1e-03 & A(:,2)<=1e-03 & A(:,2)>=-1e-03 & all(A(:,3:end)<= 1e-03,2) B=A(idx,:)

13 years ago | 0

| accepted

Answered
Help with cell subsindex
A = [41, 12, 23, 34]; r = {[1, 2, 3], [2, 4] [1, 4]}; r2=cellfun(@(x) A(x),r,'un',0) celldisp(r2)

13 years ago | 0

| accepted

Answered
How to find all zero values in a matrix?
A=[1 0.1 1;2 0.7 0;3 0.9 2;4 1.7 0] [ii,jj]=find(~A)

13 years ago | 13

| accepted

Answered
Image Normalization in the range 0 to 1
If im is your image im=(im-min(im(:)))/(max(im(:))-min(im(:)))

13 years ago | 4

Answered
How write a struct into a text file?
fid = fopen('result.txt', 'wt+'); for i = 1:size(fInfo, 1) fprintf(fid, '%d\t',fInfo(i,1).a1), fprintf(fid, '%d\t',...

13 years ago | 0

| accepted

Answered
Plot: varying X-axis Ticks
This is not possible with linear scale. Maybe with log scale, you can get a representation close to what you want

13 years ago | 0

| accepted

Answered
how can i install compiller for MAtlab fcn
In the net, look for |Supported and Compatible Compilers – Release 2011a| for example

13 years ago | 0

Answered
generating a matrix question
A=zeros(3,4); [ii,jj]=ind2sub(size(A),1:numel(A)); A(1:end)=sum([ii' jj'],2)

13 years ago | 0

| accepted

Answered
How to use set_param -function with step block in simulink?
Why do you think Reference is a parameter in a step bock. Like you see the parameters are # Step time # Initial value # Fin...

13 years ago | 6

| accepted

Answered
Limiting the number of rows of a vector
Your question is not clear. If you have a vector v=[2 3 4 5 6 10] This vector contains 6 element, you can extract the fi...

13 years ago | 0

Load more