Answered
Loop with Fixed time
for i=1:5 %somecode; pause(1-tw) % tw is your computing time end %to find your computing time use *tic* and *...

14 years ago | 2

| accepted

Answered
how to load a txt data
fid = fopen('file.txt'); line1 = fgetl(fid); res=line1; while ischar(line1) line1 = fgetl(fid); res =char(res,lin...

14 years ago | 0

Answered
How to change the color & linewidth when plotting a ftsobj
ts1 = random('Normal',0,1,100,1); ts2 = random('Normal',0,3,100,1); dates = [today-99:today]'; fts1 = fints(dates, ts1); f...

14 years ago | 1

| accepted

Answered
Undefined function for input arguments of....
create another function, for example function [x,y] = beu(x,y) if x == 0 && y == 0 disp('hello') else disp('bye...

14 years ago | 0

Answered
answer in array form
<http://en.wikibooks.org/wiki/MATLAB_Programming/Introduction_to_array_operations>

14 years ago | 0

Answered
"length" doesnt work
clear length x=[1 2 3] length(x) % Maybe you've used length as a variable

14 years ago | 0

| accepted

Answered
Creating a function in MATLAB
f=@(x) x*sin(x) %or function y=f(x) y=x*sin(x)

14 years ago | 0

| accepted

Answered
How to output your numbers into an array?
x = input('Enter start no.: ') y = input('Enter end no.: ') prim=[]; for n = x:y count = 0; for b = 1:n ...

14 years ago | 0

| accepted

Answered
Evaluating a non exact result
s=sym('15878585848585^(1/2)+555882544150*5214874852652/28752564526'); out=subs(s)

14 years ago | 0

Answered
how to write a character from a string?
s='displacement22' ; out=s(regexp(s ,'[0-9]')) %or out=s(regexp(s ,'\d'))

14 years ago | 0

Answered
How do you search a file for a matching string?
[num,text,v]=xlsread('yourfile') s1='firstname'; s2='lastname'; idx=find(strcmp(v(:,1),s1) & strcmp(v(:,2),s2) Id=v(idx,3)...

14 years ago | 0

| accepted

Answered
How to divide an image in two blocks
im=imread('yourimage') n=fix(size(im,1)/2) A=im(1:n,:,:); B=im(n+1:end,:,:) imshow(A) figure imshow(B)

14 years ago | 0

| accepted

Answered
How to add a horizontal line in a bar plot????
xlim=get(gca,'xlim'); hold on plot(xlim,[30 30])

14 years ago | 2

| accepted

Answered
'LineWidth' feature is not available in 2012a?
you will find it in doc plot

14 years ago | 1

Answered
plot a thicker line for my upper and lower specs
plot(0:600,Cal_12_usl:Cal_12_usl,'r','linestyle','--', 'LineWidth',8)

14 years ago | 0

Answered
replacing string variables with others
s1={'A','DRG MARS','FO'}; s2={'SE1','SE5','SE04'}; for k=1:numel(s1) textinfo=cellfun(@(x) regexprep(x,s1{k},s2{k}),tex...

14 years ago | 0

| accepted

Answered
solving system of equaitons
for d=0:50 P=40,000; syms F_ab F_cd F_fg sol=solve(F_ab+F_cd+F_fg+P,10*F_ab+28*F_cd+40*F_fg+d*P,144*F_ab-240*F_cd+180*F_fg)...

14 years ago | 0

| accepted

Answered
How to find the Fourier series coefficients an and bn for discrete set of points?
Look at my <http://www.mathworks.com/matlabcentral/fileexchange/37654-get-harmoniques-of-a-real-signal submission>

14 years ago | 0

Answered
division of an equation
You can't divide 1 by |[ 1 2 3]| , you should use operation element by element *./* or *.** or *.^* la=(-1:0.1:1)*pi; T10...

14 years ago | 0

Answered
How do I parse this string?
a='9.999e+20:val=1.82:val=2.15:val=2.66:val=2.18:val=1.81' b=str2double(regexp(a,':val=','split'))

14 years ago | 0

| accepted

Answered
How to change units axes in a plot
set(gca,'units','inches')

14 years ago | 2

Answered
Syntax for matlabFunction to produce vector variables and scalar variables
function [x,y,z] = my_function(t,in2)

14 years ago | 0

Answered
state space model with constant term
You can consider a constant as a disturbance signal. You can calculate your lqr regulator without this constant, but you should ...

14 years ago | 0

| accepted

Answered
Writing a 'while loop'
Initialize error to 1 for example error=1 while (error>=1.e-4) %your code end

14 years ago | 0

Answered
Overwriting the folder in matlab
delete('yourfolder/*.*')

14 years ago | 0

| accepted

Answered
How to: Raise Cell array
[n,m]=size(num); txt(end+1:n,:)={''}

14 years ago | 0

Answered
How do I separate columns?
A=rand(10,174) % Your initial array M1=A(:,1:3:end); M2=A(:,2:3:end); M3=A(:,3:3:end);

14 years ago | 0

Answered
How to add zeros to the end of an array
A=[ 1 5 3 8 9 4 7 6 5 2 ]; B=[ 5 2 3 9 7 4 5 ]; B(end:numel(A))=0

14 years ago | 2

Answered
How do you change the locations of the inputs and outputs of a subsystem in Simulink or Simevents?
You mean, you want to rotate your block, Select your block then type, *ctrl+r* twice

14 years ago | 0

Load more