Answered
Storing results from a for loop into a cell array vector
nc=numel(C); nd=numel(D) ii=repmat(1:nc,1,nd) jj=repmat(1:nd,nc,1) out=arrayfun(@(x,y) [C{x} D{y}],ii',jj(:),'un',0)

13 years ago | 0

Answered
How do I find the last occurrence of a match using regexp in MATLAB?
str = '/* This is a comment */ int x; /* sectionEndExample */'; pattern='(?<=/\*)[\w\s]+(?=\*/)'; sectionEndIdx1 = regexp(st...

13 years ago | 2

Answered
What's the best way to read in a text file
*Edit* fid=fopen('fic.txt'); v=textscan(fid,'%s','delimiter',{',',':',' '},'MultipleDelimsAsOne', 1); fclose(fid); a=r...

13 years ago | 0

| accepted

Answered
Matrix Multiplication is possible???
A=randi(10,5,6); % Example B=randi(10,6,7); p=size(A,2); C=@(i,j) sum(A(i,:)'.*B(:,j)) % If i=2 and j=6 use C(2,6) Whi...

13 years ago | 0

Answered
Matrix Multiplication is possible???
C=A*B

13 years ago | 1

Answered
code for a known answer
x=get(gca,'xlim') a=x(end)

13 years ago | 0

| accepted

Answered
Average of irregular range of data
data={'09/01/2003 21:05 1.73' '09/01/2003 21:05 2.196' '09/01/2003 21:05 1.979' '19/01/2003 19:03 6.507' '19/01/2003 19:0...

13 years ago | 0

Answered
How to compute the Sampling frequency from Time Stamps
If t is the time stamps, then he sampling frequency is fs=1./diff(t) you can check if the he sampling frequency is fixe...

13 years ago | 2

Answered
fourier transform info or data
plot(t,f) %or stem(t,f)

13 years ago | 0

Answered
output results to different excel sheets
for i = 1:5 X=y(:,i); xlswrite('output',X,sprintf('factor_%d',i); end %or you can use strcat('factor_',num2st...

13 years ago | 0

Answered
How to read multiple Excel files by a certain name sequence?
Example folder='E:\Matlab'; filetype='*.xls'; % or xlsx f=fullfile(folder,filetype); d=dir(f); for k=1:numel(d); ...

13 years ago | 1

Answered
How to display table of values on Matlab?
tableData{1,2} = double(R1); tableData{2,2} = double(R2); tableData{3,2} = double(R3); tableData{4,2} = double(R4); tableD...

13 years ago | 0

| accepted

Answered
how to resize axes within a GUI
set(handles.axes1,'xlim',[-100 100],'ylim',[-100 100])

13 years ago | 0

| accepted

Answered
How to clear data from plot in Matlab GUI
You can use cla

13 years ago | 2

Answered
How is audio data stored in matlab?
[y,Fs] = audioread('YourAudioFile'); %Y is a nx1 or nx2 array % Fs is a sample rate To get the info of your audio fil...

13 years ago | 0

| accepted

Answered
Compare arrays in Simulink
A = [4.1,5.2,7.1]; B = [1,2,3,45,6,7,8]; out=zeros(size(B)); out(fix(A))=1

13 years ago | 0

Answered
2 digit input to a loop
ModeNumber=input('First mode '); ModeLast=input('Last mode '); for mLoop = ModeNumber:ModeLast A(mLoop)=cos(mLoop) ...

13 years ago | 0

| accepted

Answered
Vector where elements equals previous elements + 1
a=[1 1 1) out=cumsum(a)

13 years ago | 0

Answered
In a logical array index the area with the most TRUE values
t=[0 1 0 0 0 0 1 1 0 0 1 1 1 1 1 1 1 1 1 1 0 1 0 0 0 1 0]; a=find(diff([0 t 0])); idx1=a(1:2:end); idx2=a(2:2:end)-1; [...

13 years ago | 2

Answered
Searching for values that a particular variable takes in a single text file
If your text file contains only numbers, you can use M=dlmread('YourFilename.txt')

13 years ago | 0

| accepted

Answered
Creating a new matrix in a loop from a pre-determined matrix
a=[1 5 3;4 10 6;7 11 19;20 30 50] c=(max(a')-min(a'))/10 ax=c(1) ay=c(2) az=c(3)

13 years ago | 0

| accepted

Answered
Creating a matrix using a loop
y=repmat(x,numel(x),1) y(:,1) % the first vector y y(:,2) % the second % and so on

13 years ago | 0

Answered
Can I see values of variables while a code is running.
You can use display function a=10 display(a) But this will make your code slower

13 years ago | 1

Answered
should the "sample time" be same in all the blocks in a model in SIMULINK???? what is the use of "sample time" in gain block???
*Edit* You can use different sample time for different blocks, that depends on what you want. you can set the sample time to...

13 years ago | 0

| accepted

Answered
sample time (-1 for inherited)
<http://www.mathworks.com/help/simulink/ug/inheriting-sample-times.html#bsm0059 inherit sample times>

13 years ago | 0

| accepted

Answered
how to split the string to cells?
s='SAMPLE_20120807_1806 0 +1.122117E+1 +7.190077E+0 +1.460343E+1' regexp(s,' ','split')

13 years ago | 0

| accepted

Answered
save variables in .mat files with desired name.
myData = [1 2 3 4 5 6 7 9]; newName = input('I want to save the variable under the name:', 's'); assignin('base',newName,m...

13 years ago | 4

Answered
Reshape a matrix according to specific columns.
a=1000; b=2000; c=3000; A=[1 a 5; 1 b 6; 1 c 13; 2 a 8; 2 b 9; 3 a 10; 3 b 11; 3 c 12] ii1=unique(A...

13 years ago | 0

| accepted

Answered
Cut vector in set range
How your vectors are stored? in a cell array? If yes Example v=arrayfun(@(x) randi(2000,1,100),1:10,'un',0) % your cell ...

13 years ago | 2

Answered
eval for running functions
look at str2func function

13 years ago | 0

Load more