Answered
How can I change frequancy of Sine wave in simulink based on other output blocks?
use a matlab function block with two inputs : the pulse w and the time (from clock block)

13 years ago | 0

Answered
How to delete elements in array efficiently
You can also do it with while loop Vector=[1 2 3 4 5 66 88 100 101 14] i=1; while i<numel(Vector) if Vector(i+1) - V...

13 years ago | 0

Answered
How to delete elements in array efficiently
Vector=[1 2 4 5 66 88 100 101] id=find([0 diff(Vector)]==1)-1 Vector(id)=[]

13 years ago | 2

| accepted

Answered
How do I edit contents of variables displayed on workspace window?
v=10; display(v) % to clear a variable clear v % to change a variable v v=20 You can also click on your va...

13 years ago | 0

Answered
using different cases of switch command with if else
loc=2 switch loc case 1 P=[170 255 280] case 2 p=[120 155 190] end This code means: if ...

13 years ago | 0

| accepted

Answered
A small problem about the Cell Array.
a=2; b=[2 5]; c=[2 4;4 5]; A={a,b,c}

13 years ago | 0

Answered
pls I what to know the procedure to follow, in order to acquire sound using sound card and MATLAB
If you have Data Acquisition toolbox % Create analog input object ai = analoginput('winsound'); addchannel(ai, 1); % set...

13 years ago | 0

Answered
Trapz abnormal behavior. Error:Subscript indices must either be real positive integers or logicals.
What are you expecting with |trapz(2.2,2.2)|? to compute the integral along x, you will need at least 2 points

13 years ago | 1

Answered
Some problem in taking values from particular text file
A1=A(:,1:3:end); A2=A(:,2:3:end); A3=A(:,3:3:end); out=[A1(:) A2(:) A3(:)]'

13 years ago | 0

| accepted

Answered
How can I repeat an iteration after if has been verified?
Use a while loop instead a for loop g=1; while g <10 h(g,:) = Grubbs(r(g,:),0.05,'right'); if h(g,:) == 1 ...

13 years ago | 2

| accepted

Answered
Generate evenly distributed coordinates
*Edit* n=10 distance=4; x1=0:distance:(n-1)*distance; x2=distance/2:distance:n*distance-distance/2; distancev=distance*...

13 years ago | 0

Answered
Generate evenly distributed coordinates
distance=2 x=0:distance:100

13 years ago | 0

| accepted

Answered
Matrix Manipulation based on index
P=M(v,:);

13 years ago | 0

| accepted

Answered
How to extract array subset
WaveLength(WaveLength>=Low_WL & WaveLength<=High_WL)

13 years ago | 0

| accepted

Answered
How to check "Undefined function or variable..." error with a variable in Matlab program?
I am sure the error does not concern those lines of code. Post the entire code, maybe there is another line where M is used at t...

13 years ago | 1

Answered
How to convert a bit sequence to array?
a='10011010010' out=a-'0'

13 years ago | 1

| accepted

Answered
Convert a 3-d matrix to a 2-d matrix
out=val(:,:,1).*10.^(fix(val(:,:,2)/10)+1)+val(:,:,2)

13 years ago | 0

Answered
Save matlab output in textfile
x=[1;2;3]; y=[10;20;30]; v=[x y] dlmwrite('yourfile.txt',v,'delimiter',' ') %or dlmwrite('yourfile.txt',v,'delimite...

13 years ago | 0

| accepted

Answered
How to read a string character by character?
s='CCTV03x456x1658.avi' s=s(1:strfind(s,'.')-1)

13 years ago | 1

| accepted

Answered
Computational times for various routines?
You can use tic toc

13 years ago | 1

Answered
Operation on cell array
a={rand(3,2) ;rand(7,2);rand(2,2);rand(12,2)} % Example id=cellfun(@numel,a) [~,max_idx]=max(id) array_max=a{max_idx} ...

13 years ago | 1

| accepted

Answered
how to repeat a bit sequence?
key =1234; bit_sequence = dec2bin(key) new_bit_sequence=repmat(bit_sequence,1,50)

13 years ago | 0

| accepted

Answered
finding only unique values
[ii,jj]=sort(x); out=sort(jj(strfind(logical([1 diff(ii) 1]),[true,true])))

13 years ago | 0

Answered
How to sample data from a plot to a function.?
Click on your plot then type x= get(gco,'xdata') y=get(gco,'ydata')

13 years ago | 0

| accepted

Answered
How can I import excel and mass spectra data into matlab
Look at <http://www.mathworks.com/help/matlab/ref/xlsread.html xlsread>

13 years ago | 0

| accepted

Answered
How to replace an element in an struct array
Because |newgeneration(i).penalty| when i >100 contains more then 10 elements If you want to take the first 10 elements ...

13 years ago | 0

| accepted

Answered
structures consolidation and manipulations
For vertical concatenation names=fieldnames(a); for k=1:numel(names) b.(names{k})=cat(1,a(:).(names{k})); end b

13 years ago | 0

Answered
grouping structures together based on filter
%Example a.mydata=randi([-10 10],135,6) a.myid=randi([-10 10],1,6) a.mydates =randi([-10 10],135,1) %-------------------...

13 years ago | 0

Answered
Clearing legend in GUI plot
legend('hide') %for your GUI it is: legend(handles.axes1,'hide')

13 years ago | 6

Answered
Looping through data and finding maximum value in each bin
v=[10 5 1 10 6 2 11 3 2 11 7 1 11 4 1] [c1,ii,jj]=unique(v(:,1),'stabl...

13 years ago | 0

Load more