Answered
How to sum up a matrix with upper diagonal direction without for-loop condition
This one should be faster A= [ 1 2 3 4 5 6 7 8 9; 2 3 4 5 6 7 8 9 10; 3 4 5 6 7 8 9 10 11]% [n,m]=size(A); A(:,end+1:end...

12 years ago | 0

Answered
How to sum up a matrix with upper diagonal direction without for-loop condition
A= [ 1 2 3 4 5 6 7 8 9; 2 3 4 5 6 7 8 9 10; 3 4 5 6 7 8 9 10 11]; [n,m]=size(A); A(:,end+1:end+n-1)=0; B=sum(cell2mat(arr...

12 years ago | 1

Answered
extract a number from text file
FID = fopen('file.txt'); form='%f %f %f %f %f %f %f'; % we have 7 columns, then use 7 %f n = 7; % numbers of lines represent...

12 years ago | 0

| accepted

Answered
How to Measure Motor Speed?
From what I've understood, after each pulse, your motor has done a half of a revolution. You will need to use a *clock* block to...

12 years ago | 0

Answered
Reshaping a a matrix
a=[1 2 3 4 5 6 ; 7 8 9 10 11 12] [n,m]=size(a); b=reshape(a',m,1,[]); c=permute(reshape(b,2,[],size(b,3)),[2 1 3]); out=c...

12 years ago | 0

| accepted

Answered
Can anyone help me to search for ones in the rows of a matrix and replace the remaining ones with zeros?
a = [1 1 0; 1 1 1; 0 1 1] b=zeros(size(a)) b(1,:)=a(1,:)

12 years ago | 0

Answered
how can change the value of one bit in a pixcel
a='00000010', a(7)=num2str(not(str2num(a(7))))

12 years ago | 0

Answered
how can change 1 bit of a pixcel ?
m='0001001' m='1001001'

12 years ago | 0

| accepted

Answered
How to put the info of txt file into an array?
dlmread('file.txt')

12 years ago | 0

| accepted

Answered
How to find intersection of data sets
Look at this example x=0:0.01:10; y1=sin(x); y2=cos(x); plot(x,y1,x,y2) idx=sign(y2-y1) i1=strfind(idx,[1 -1]); i2=st...

12 years ago | 0

Answered
How to export a matrix in a text file?
A=[1 2 3 4 5 6] dlmwrite('dataexport.txt',A,'delimiter','\t','newline','pc')

12 years ago | 1

| accepted

Answered
How to delete cell entries with an index vector
n=3; m=6; A=num2cell(rand(m,n)) idx=[1 0 0 1 1 0] A(logical(idx),:)=[]

12 years ago | 1

Answered
How can keep attributes as a vector while simulation proceed ?
Pt=2.3 Vector=Pt Pt=3.1 Vector=[Vector Pt] Pt=2.7 Vector=[Vector Pt] Or Pt=2.3 Vector(1)=Pt Pt=3.1 Vector(2)=...

12 years ago | 0

Answered
Indexing problem for matrix
S=100; T=1; sig=[0.05:0.01:0.45]; m=0.07; t=1/252; E_T=0; in=S*ones(3,41)%41 size sig; while E_T < T -10^(-5) ...

12 years ago | 0

Answered
Matrix names within a matrix
mass=[1 2;3 4] front_area=[45 6 77] A={mass;front_area} Then type A{1} A{2}

12 years ago | 0

Answered
pick columns with a index vector
%Example A=rand(30,100) B=randi([0 1],1,100) %---------------------- out=A(:,logical(B))

12 years ago | 0

Answered
plz help me with this error
The error message indicates that the file you are trying to read is not supported by the function wavread

12 years ago | 0

Answered
How to shift rows in a matrix by different values (e.g. line 1 n-spots, line 2 m-spots and so on) without using a loop
id=randi(size(cycle,2),1,size(cycle,1)) out=cell2mat(arrayfun(@(x) circshift(cycle(x,:),[1 id(x)]),(1:numel(id))','un',0))

12 years ago | 1

Answered
MATLAB not saving variables to workspace
They are different type of file : script file and function file

12 years ago | 0

Answered
Subract specific areas from array
A= [1 2 2 1 1 1 2 2 2 2 2 1 1 2 2 0 2 2 0 0 0 1 2 2 2 1 0 1 ]; ArrayOut1=zeros(size(A)); ArrayOut2=ArrayOut1; idx1=union(s...

12 years ago | 0

| accepted

Answered
Subract specific areas from array
ArrayIn= [0 0 0 0 2 2 1 1 1 2 2 2 2 2 2 2 2 1 1 1 2 2 0 2 2 0 0 0 ] B=num2str(ArrayIn); B=strrep(B,' ',''); [ii1,ii2]=regex...

12 years ago | 0

Answered
How can I set no initial value for the unit delay block ??
I'am not following you, the initial value of the unit delay block is used, only at the start of your simulation, and you can set...

12 years ago | 0

Answered
type conversion, precision loss
It's what Matlab do. I don't think, there is a logic behind it. If the result was double, you can ask the same question. you...

12 years ago | 0

Answered
Insert Zeros (m -rows) in an existing Matrix every n-rows in an efficient way
[n,m]=size(A) B=permute(reshape(A',m,3,[]),[2 1 3]); p=size(B,3) C=[B;zeros(2,m,p)] out=reshape( C(:,:),[],m,1)

12 years ago | 0

| accepted

Answered
problem in designing state feedback controller
You can consider your model as SISO with two disturbance signals. Set those two constant signal to 0 and find the transfer funct...

12 years ago | 0

| accepted

Answered
store values from a loop in a vector
Just creat a matrix nxm

12 years ago | 0

Answered
Elements in a matrix
Idx=find(A==1)

12 years ago | 0

| accepted

Answered
How do get the cell matrix to be double?
out=cellfun(@str2num,DecompDict,'un',0) To display your data celldisp(out) 1x10 double means an array of ten number...

12 years ago | 0

Answered
HOW TO GENERATE SQUARE PULSE
If you have signal processing toolbox, use |pulstran| *EDIT* Amp=1 % Pulse amplitude Wd=0.07 % Pulse width sp=[1....

12 years ago | 0

| accepted

Answered
How to solve atan2 function Problem?
What you are doing is not clear. But if you want to have angles more than pi, you have to add k*pi to the result given by atan2 ...

12 years ago | 0

Load more