Answered
How can I sort data like this?
sort(A)

14 years ago | 0

| accepted

Answered
How to check the existence of a file and rename it.
s=dir ('yourfolder/yourfilname'); file=s.name !rename file new_filename check the existing file by exist('yo...

14 years ago | 0

Answered
Ho to repeat a vector?
vec=1:5 out=[vec;vec]; out=out(:)' If you want to repeat n times vec=1:5 n=10; out=repmat(vec,n,1); out=out(:)'...

14 years ago | 0

Answered
i need to convert a string to a num without using the "str2num" function but in the final answer i have some undesired spaces. how can i remove them?
st = '14523' x = double(st) y = sum((x-48).*10.^(numel(st)-1:-1:0))

14 years ago | 1

| accepted

Answered
Error using unique command
*Edited* A=[1000 16000 100000 30000 2000] B=[150 100 4000 5000 2000]; [~,idx]=sort(A) [~,idx1]=sort(idx) C=B(idx1)

14 years ago | 0

| accepted

Answered
Unit delay connected to pulse generator
You said that Sample time is inherited, which means it's inherited from your step size (variable or fixed). If you want *1s* the...

14 years ago | 1

Answered
How to plot with continuous line
Use plot after the loop for ii= 1:5 x(ii)=ii array(ii) = ii*3; end plot (x, array); %don't use i and j...

14 years ago | 0

| accepted

Answered
Finding the position of valaue
out=arrayfun(@(x) find(B==A(x)),1:numel(A))

14 years ago | 0

| accepted

Answered
How to run simulations in Matlab?
You can use Simulink Help (Getting started), you also can find videos in youtube <http://www.youtube.com/watch?v=KUa1MWm8bvk>

14 years ago | 0

Answered
Problem with fopen - not a valid target for assignment
You have brackets missing in your code axis([0 2.5 100 -900

14 years ago | 1

| accepted

Answered
Executing a Simulink function from a Matlab function in Stateflow
You can use Simulink Function (Graphic function available in your chart)

14 years ago | 2

Answered
Randsample in matlab 2007
randi(1000000000,1)

14 years ago | 0

| accepted

Answered
How To Create A Periodic Triangle Function?
w=4; % signal width Amp=4; % signal amplitude tt=-w:w t1=-2*w:0; t2=0:2*w; t=[t1 t2]; y1=Amp-Amp*abs(tt)/w ; y=[y1 -y1]...

14 years ago | 0

Answered
How to save a plot of a pulse to a matrix to load it whenever i want to see it
You can save your data in a mat file then load a file. t=0:0.1:10; y=cos(t); z=sin(t) save file t y z %to call your...

14 years ago | 0

Answered
Insert Text in plot
text(x,y,'yourtext')

14 years ago | 2

| accepted

Answered
how to run this function into one way run?
k=[1,2,3,4,5,6,7] w=8; x=2; a=0.2 ; w=(0:0.3:3) S=cell2mat(arrayfun(@(k) 1-exp(-a*x*k.*w),k','un',0)) close plot(w,S,...

14 years ago | 1

| accepted

Answered
add numerical array as column or in cell array
C = {'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p'} a=[1 2 3 4] out=[num2cell(a)...

14 years ago | 2

Answered
How to solve algebraic loop error??
Algebraic loop occurs often, when you have a feedback through a constant block or equivalent, which means your signal |y(t0)=con...

14 years ago | 19

| accepted

Answered
How to plot a 51*51*51 array
mesh(Ppr(:,:,1),Ppr(:,:,2),Ppr(:,:,3))

14 years ago | 2

Answered
Assign values to string array
A={'x','y','z'}; B=[1 6 7]; arrayfun(@(x) assignin('base',A{x},B(x)),1:length(A))

14 years ago | 0

Answered
Error using bitget and bitset in array
The size of C is 2 and you re using *for i=1:11* Index exceeds matrix dimensions, because C(3) does'nt exist C=[1081;105...

14 years ago | 0

| accepted

Answered
All possible combinations of 2 vectors.
save this function function y=arrangement(v,n) m=length(v); y=zeros(m^n,n); for k = 1:n y(:,k) = repmat(...

14 years ago | 0

Answered
ho to get rid of repeated cells in cells arrays functions
contextt={{1 2 3 4},{1 1 2 5},{2 2 2 6 7}} out=cellfun(@(x) unique(cell2mat(x)),contextt,'un',0)

14 years ago | 1

| accepted

Answered
Draw a line and a plane at fixed ponit in 2d and 3d plot
x=0.0039 plot([-10 10],[x x])

14 years ago | 0

Answered
How to draw plotmatrix in logscale?
data=magic(5) [h,ax,B,P]=plotmatrix(data) set(ax,'xscale','log'); set(ax,'yscale','log');

14 years ago | 1

Answered
Importing periodic data with textscan and fgetl?
fid = fopen('file.txt'); line1 = fgetl(fid); res=line1; while ischar(line1) line1 = fgetl(fid); res =char(res,line1) ...

14 years ago | 1

Answered
I want to store two worksheets together in excel sheet from matlab.
a=rand(5) b=rand(5) xlswrite('filename.xls',a,'sh1') xlswrite('filename.xls',b,'sh2')

14 years ago | 0

Answered
How to convert strings to a matrix
This code takes in account more then one blanck space s='Hello world' s1=regexp(s,' ','split'); out=s1(~cellfun(@isemp...

14 years ago | 0

| accepted

Answered
Randi with string variables
items = {'lapin', 'souris', 'voiture', 'saumon', 'vĂˆlo', 'table', 'cochon'} n=numel(items); out=items(randi(n,n,1)) If ...

14 years ago | 1

Load more