Answered
How can I store vectors from three loops?
[a,b,c,d]=deal(zeros(10*29*48,1)); p=0; for i = 1:10 for j = 2:30 for k = 3:50 p=p+1; ...

12 years ago | 0

Answered
Function with variable number of input arguments
In your case you can just use nargin to know the number of inputs. Look at this example function y=fcn10(a,b,c,d) if nar...

12 years ago | 7

| accepted

Answered
Continuous/Discrete Simulink Problem
If you want to discretize your system N=1 D=[1 1] h=tf(N,D) % continuous transfer function ts=4 % sampletime g=c2d(h,...

12 years ago | 0

| accepted

Answered
How do I find the right peaks?
Use <http://www.mathworks.com/help/signal/ref/findpeaks.html findpeaks>

12 years ago | 0

Answered
How to create a long list using the same number?
repmat(59,1000,1) %or 59*ones(1000,1)

12 years ago | 0

| accepted

Answered
How to loop through files that I have added to path?
pat='E:' % Your folder fil=fullfile(pat,'*.tif') d=dir(fil) for k=1:numel(d) filename=fullfile(pat,d(k).name) % ...

12 years ago | 1

| accepted

Answered
symbollic solving from character string
syms(inputs{1}) %or syms(inputs{1:2}) %or if you want the entire cell syms(inputs{:})

12 years ago | 0

| accepted

Answered
fast and beautiful way to convert vector ranges to indexes
v2 = [5; 2; 3]; v3=cell2mat(arrayfun(@(x) repmat(x,1,v2(x)),1:numel(v2),'un',0))

12 years ago | 1

Answered
loading .mat files in a simulink user defined function
You didn't post how you are downloading your file, I guess you have used the command load filename If your mat file cont...

12 years ago | 0

Answered
Pass data in subcells in a cell array to double-type data
If your data looks like this: A={'a' 'b' 1 2 {3};'c' 'd' 4 5 {6}} A(:,5)=cellfun(@(x) x{1} ,A(:,5),'un',0)

12 years ago | 1

| accepted

Answered
Time difference calculated with datenum
The difference is very small: 1.0e-09, it's probably due to the way your data are stored. Look at this link <http://matlab.wiki...

12 years ago | 0

| accepted

Answered
Remove/replace ' i.e single quote from a sentance ...
str='asad''' out=strrep(str,'''','')

12 years ago | 0

| accepted

Answered
Assigning excel data to an array via a counter
t=zeros(size(data,1),2) for i=1:1:2 t(:,i)= data(:,5*(i-1)+1); %Time end

12 years ago | 0

| accepted

Answered
Eval on multi-line strings - no return value?
str='a=12' eval(str) % When you run this line, the number 12 will be assigned to 12 str='a=12' result=eval(str) % eval...

12 years ago | 0

Answered
Shifting state space variables by constant value
You gave an incomplete state space equation. What about the output? y[k]=e.x[k]+d u[k] , The output should also change ...

12 years ago | 0

Answered
How to speed up this code?
You can use arrayfun, but you will notice that the for loop is faster. cv=arrayfun(@(k) copula_Clayton(Amat(k,1:n),alpha_0)...

12 years ago | 0

Answered
Assign excel data to multi-dimensional array
Change this line (alldata should be the third output argument) [~,text,alldata] = xlsread(ExcelFile, SheetNumber, InputData...

12 years ago | 0

Answered
Trouble reading number from file
data=importdata('filename.txt')

12 years ago | 4

Answered
Finding maximum value of each column of a matrix amd locate it in a new vector
v=max(your_array)

12 years ago | 3

| accepted

Answered
importing state space models to simulink
A=[-2 1;-3 0]; B=[0;1] C=[1 0] D=0 set_param('untitled/State-Space','A','A','B','B','C','C','D','D') % untitled is the n...

12 years ago | 1

| accepted

Answered
multiple digit number in to individual digits
a=1234 b=str2double(regexp(num2str(a),'\d','match'))

12 years ago | 6

| accepted

Answered
Reducing values preceding the 1st minima to zero
y = [10 9 8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 5 4 3 2 3 4 3 2 1 0.5 0.3 0.2 0.1 0]'; [~,jj]=findpeaks(-y,'npeaks',1) z=y z(1:jj)=...

12 years ago | 0

| accepted

Answered
Solving a two unknown function
syms x y z=x^2+2*y sol=solve(z)

12 years ago | 0

| accepted

Answered
Storing Integer Values in Matlab?
What you need to do is ii=0; for TSR=1:0.1:10 ii=ii+1; store_F(:,ii)=F;

12 years ago | 0

Answered
regexp(a,exp) related question.
a='<img src="images/flags/.gif" border=0 alt="">Country' b=regexp(a,'(?<=>).+','match')

12 years ago | 0

| accepted

Answered
Merging of Cell data into one entry.
A={'AMEX' 'ARCA' 'BATS' 'BEX' 'CHX'}; B=strjoin(A,',')

12 years ago | 0

| accepted

Answered
How generate one signale of this (in picture)
This is a random signal y=rand(1,10) plot(y)

12 years ago | 0

Answered
Create new variable considering specific rows & columns of a cell-array
A={ 'Y' 2000 2001 2002 2003 2004 2005 2006 2007 2008 1 NaN NaN 33 33 33 33 33 NaN NaN 5 NaN 2 ...

12 years ago | 1

| accepted

Answered
Fitzhugh Nagumo code question
Write this function and save it as myode.m function dy=myode(t,y) dy=zeros(2,1) a=0.8 b=0.7 g=0.08 I=0.5 dy(1)=y(...

12 years ago | 0

Answered
Count elements not including blank entries in a cell array
A={18 76 [] 76 28 28 22 [] [] 123 123 123 25 12 12 12 [] []} idx=sum(~cellfun(@isempty,A),2) ...

12 years ago | 4

| accepted

Load more