Answered
How can I insert a sequental columns in a matrix with a lag of three columns?
A=randi(9,4,3) n=size(A,2) B=nan(size(A,1),n*3) idx=1:3:size(B,2) B(:,idx)=A

9 years ago | 0

| accepted

Answered
How to add new rows to text file with missing data?
s=importdata('fic.txt') out=zeros(s(end,1),4) out(s(:,1),:)=s

9 years ago | 1

Answered
How to use findpeaks?
You can find what you want in the help <http://www.mathworks.com/help/signal/ref/findpeaks.html>

9 years ago | 0

Answered
How to delete empty lines in a table
If A is your table idx=all(cellfun(@isempty,A{:,:}),2) A(idx,:)=[]

9 years ago | 2

Answered
Read text file in MATLAB
M=importdata('yourfile.txt') a=regexp(M,'\S+','match'); b=strrep([a{:}],'j','j*') c=str2double(b) out=reshape(c,[],2)

9 years ago | 0

| accepted

Answered
How can I delete header from a .txt file and save it?
fid=fopen('file.txt') s=textscan(fid,'%s%s%s%s%s','headerlines',1) fclose(fid) ss=[s{:}] fid1=fopen('file.txt','w') for k...

9 years ago | 0

| accepted

Answered
Replace Cell Array with other Cell Array
a1 = { 'i', 'love', 'you', 'you', 'love'; 'i', 'you', 'love', 'i', 'much'} a2 = { [], [], [], 'so', 'much...

9 years ago | 0

| accepted

Answered
How to find the value in a column that's most close to a specific number?
A = [1;2;3;4;5;6;7] b=2.7 [~,idx]=min(abs(A-b))

9 years ago | 1

| accepted

Answered
Problem: Invalid dimensions specified for output port..
C=0 and D=0 means that your system output will be always equal to 0. Plus the feedback K*u is a 1x5 array when your state space ...

9 years ago | 0

Answered
Dividing matrix in four parts
A=rand(210,3); out=mat2cell(A,[40 60 30 80]',3) You have your 4 matrices out{1} out{2} out{3} out{4}

9 years ago | 0

Answered
How to separate log file data containing different strings?
fid=fopen('fic.txt') line=fgetl(fid); k=1; while ischar(line) a{k,1}=line; line=fgetl(fid) k=k+1 end fclos...

9 years ago | 0

| accepted

Answered
how can I generate a sequence of sinc pulses corresponding to a given sequence.like for 1 plot positive sinc and for 0 plot negative but in sequence and on same plot
t=-5:.001:5; x = randsrc(1,200,[1,-1,; .5,.5]); n=length(x); w=0.5; p=sinc(2*w*t); figure hold on for ii=1:n plot(...

9 years ago | 0

| accepted

Answered
roots of a complicated function
Use solve function <http://www.mathworks.com/help/symbolic/solve.html>

9 years ago | 0

| accepted

Answered
convert symbols to variables
syms x d f = x*sin(d) df=diff(f,d) d1=pi x1=5 out=subs(df,[d x],[d1 x1])

9 years ago | 0

| accepted

Answered
Search for an element in cell array?
A=[NaN 51.1512 4.0000 6.0000 NaN 80.7646 3.0000 6.0000 NaN 89.3755 2.0000 6.0...

9 years ago | 0

| accepted

Answered
I want to create a 3D mesh that looks like this
[xx,yy]=meshgrid(x,y) mesh(xx,yy,zz)

9 years ago | 0

Answered
Create a table with values
table function was introduced in Matlab R2013b, what version of Matlab are you using?

9 years ago | 1

Answered
Using for loops with a logical to compute means of different Names.
M={'A' '1'; 'B' '5'; 'C' '13'; 'B' '7'; 'A' '11'} [ii,jj,kk]=unique(M(:,1)) out=[ii accumarray(kk,(1:numel(kk))',[],@(x) {me...

9 years ago | 0

| accepted

Answered
What code is needed for the following for example: 'A' '1' ; 'B' '5' ; 'C' '13' ; 'B' '7' ; 'A' '11'
a={'A' '1'; 'B' '5'; 'C' '13'; 'B' '7'; 'A' '11'} b=str2double(a(:,2)) idx=ismember(a(:,1),'B') out=mean(b(idx))

9 years ago | 0

| accepted

Answered
How can i find an eleiment which comes only one in a matrix ?????
A=[1 2;1 3;1 4;1 5;2 4] [ii,jj,kk]=unique(A) b=accumarray(kk,(1:numel(kk))',[],@numel) out=ii(b==1)

9 years ago | 1

| accepted

Answered
Finding a row with a certain condition
A=[733458 91 1.01510000000000 1.01680000000000 1.01490000000000 1.01520000000000 1.01585000000000 733458 112 1.01620000000000...

9 years ago | 1

| accepted

Answered
how to remove unwanted zeros from a vector
a=[ 0 5 0 0 0 0 4 5 6 0 0 0 9 9 8 0 7 6 0 0 0 0 0 0 3 4 4 0] idx=a==0 ii1=strfind([0 idx],[0 1]) ii2=strfind([idx 0],[1...

9 years ago | 1

Answered
finding a string in a cell array
ids1={'519448(EPS1MN)' '519448(EPS2MN)' '519448(EPS3MN)' '519448(EPS4MN)' '519448(EPS5MN)' '519448(LTMD)' '519448(P)' '...

9 years ago | 0

| accepted

Answered
Concatenate cell of arrays
A={randi(5,3,5) randi(5,2,5)} B=cell2mat(A')

9 years ago | 1

| accepted

Answered
Cumulative sums of values corresponding to all duplicate values in a vector
Identification = [1 1 1 1 2 2 2 3 3 3 3 3 3 4 4 4 5 5 5 5 5] Year = [2013 2012 2011 2010 2012 2011 2010 2008 2007 2006 2005 2...

9 years ago | 0

Answered
How to plot two functions by using looping values in the same graph using Matlab?
instead plot, use scatter function scatter(j,m) Or store all your values in one array called m with same size as j, and ...

9 years ago | 0

Answered
How to convert a file containing real numbers into binary/hexadecimal?
You can use dec2bin and dec2hex function

9 years ago | 0

Answered
How to get pair of subplots in two different figures.
figure(1) plotyy(t1,x1,t2,x2) figure(2) plotyy(t3,x3,t4,x4)

9 years ago | 0

Answered
How to select elements in an array that are in sequence?
a=[1 2 3 4 31 32 33 34 35 36 37 38 39 40 41 42 56 57 58 59] id=[1 diff(a)]==1 ii1=strfind([0 id],[0 1]) ii1(2:end)=ii1(2:en...

9 years ago | 0

| accepted

Answered
How to sort or rearrange a column with respect to the other column?!
Use sortrows function. For example A=[241 5;1245 4;684 4;806 4;674 3] B=sortrows(A,2) % Or by descending order B...

9 years ago | 1

| accepted

Load more