Réponse apportée
How to make a loop for an array of ands including cell arrays
%------Example-------------------- A=cell(1,5) A=cellfun(@(x) rand(10,9,8),A,'un',0) %-----------------------------------...

plus de 9 ans il y a | 0

| A accepté

Réponse apportée
How to trim two vectors of differing lengths
n=min(numel(A),numel(B)) A=A(1:n) B=B(1:n)

plus de 9 ans il y a | 2

| A accepté

Réponse apportée
Separate values for year and month
Look at this example: d1=datenum('1997-01-01 00:00','yyyy-mm-dd HH:MM'); d2=datenum('2016-08-31 00:00','yyyy-mm-dd HH:MM')...

plus de 9 ans il y a | 1

Réponse apportée
How can I find the first index of an 1D-array at which all following Elements are smaller the a specific value?
A=[1 2 5 6 4 7 2 3 5] b=8 id=find(A>b,1,'last')

plus de 9 ans il y a | 0

Réponse apportée
How do I add NaNs to each of a set of vectors of different lengths to make them all the same length please?
v1=(1:5)'; v2=(1:8)'; v3=(1:7)' n=10 A={v1 v2 v3 } out=cell2mat(cellfun(@(x) [x;nan(n-numel(x),1)],A,'un',0) )

plus de 9 ans il y a | 1

Réponse apportée
I have matlab .m code that I want to convert to simulink. How?
You can use Matlab function block <http://www.mathworks.com/help/simulink/slref/matlabfunction.html>

plus de 9 ans il y a | 0

Réponse apportée
How to replace multiple strings with another string
str='Hello girl and cat' out=regexprep(str,'girl|cat','boy') %If you want to use strrep str='Hello girl and cat' out...

plus de 9 ans il y a | 3

| A accepté

Réponse apportée
Manipulate time series matrix
M=[1997 01 01 00 00 0.5 1997 01 01 00 15 0.2 1997 01 01 00 30 0.0 1997 01 01 00 45 0.0 1997 01 01 01 00 0.0 1997 01 01 01...

plus de 9 ans il y a | 0

Réponse apportée
How to remove additional rows from a matrix?
|b(j,2) is not defined for j=max(length(a),length(b))| What are you expecting as result for this small example: a=[4 1;5...

plus de 9 ans il y a | 1

Réponse apportée
How to plot a first order differential equation with singular point?
Save this file as odef.m function dx=odef(t,x) dx=zeros(2,1) dx(1)=x(2); dx(2)=(-5*x(2)-3*x(1))/(1-x(1)^2) Then call ...

plus de 9 ans il y a | 0

| A accepté

Réponse apportée
Changing elements with a condition
s='00000011010000' ss='1' out=regexprep(s,'(1.+)','${repmat(ss,1,numel($1))}') %or simply s='00000011010000' idx=fi...

plus de 9 ans il y a | 0

Réponse apportée
Generate a set of 1000 elements where each element is a set of 40 elements
A=cell(1,1000) B=cellfun(@(x) randi(10,1,40),A,'un',0) % Example

plus de 9 ans il y a | 0

| A accepté

Réponse apportée
why its not work
If you want to do it with a for loop n1=5; for x=50:5:200; y=2*pi*n1./x; scatter(x,y); hold on end

plus de 9 ans il y a | 1

Réponse apportée
Removing elements in an array
A=[1 2 3 4] B=[5 10 15 20] c=[10 20] %numbers to remove from B idx=ismember(B,[10 20]) A(idx)=[]

plus de 9 ans il y a | 3

| A accepté

Réponse apportée
How do I get the closest values of an array stored for a particular input ?
A = [180 170 160 150 140 130] b=165 a1=min(A(A>b)) a2=max(A(A<b))

plus de 9 ans il y a | 1

| A accepté

Réponse apportée
How to convert a string to a 8 bit Ascii one row binary vector?
s='abcd' p=dec2bin(double('abcd'),8)' out=p(:)'

plus de 9 ans il y a | 0

| A accepté

Réponse apportée
String elements of a cell as a name to the array elements of another cell
What is the aim of doing this? this is not recommended, read this <http://matlab.wikia.com/wiki/FAQ#How_can_I_create_variables_A...

plus de 9 ans il y a | 3

Réponse apportée
Reshaping / regrouping cell arrays?
*Edit* A=num2cell(reshape(1:12,3,4)') %-----Example--- [n,m]=size(A) k=3 p=fix(n/k) AA=A(1:p*k,:) B=mat2cell(cell2mat...

plus de 9 ans il y a | 1

| A accepté

Réponse apportée
How to read the LAST sheet in excel
To get the name of the last sheet use xlsfinfo [~,name]=xlsfinfo('file.xlsx') last_sheet=name{end} N=xlsread('file.xlsx'...

plus de 9 ans il y a | 1

| A accepté

Réponse apportée
How to Write all of an if-statement in a Single Lline?
if A ==1 B = 2, else B = 3, end But what is the aim of this?

plus de 9 ans il y a | 4

| A accepté

Réponse apportée
Convert 2D into 3D matrix
reshape(A(:),16,[])'

plus de 9 ans il y a | 0

Réponse apportée
finding elements in a matrix`
A= [1 3 10; 1 8 10; 2 4 9] x=[ 2 9] for k=1:size(A,1) idx=all(ismember(x,A(k,:))); if idx break end end idx

plus de 9 ans il y a | 0

| A accepté

Réponse apportée
Can I create array which its elements also arrays ?
Use cell arrays A={[1 2 3] [4 5 6]}

plus de 9 ans il y a | 0

Réponse apportée
Shuffle a vector of repeated numbers so the numbers do not repeat
*Edit* fam1_1 = [1,1,1,2,2,2,3,3,3,4,4,4] ii=unique(fam1_1) n=numel(fam1_1) m=numel(ii) p=numel(fam1_1)/numel(ii) x=i...

plus de 9 ans il y a | 1

| A accepté

Réponse apportée
Function to create duplicate obs based on the value of a string variable
str='abc-def-keh-ABC' a=regexp(str,'[a-z]+','match') out1=numel(a)

plus de 9 ans il y a | 0

Réponse apportée
counter increment based on sample time
Can you explain how to identify if a variable is high or not? what kind of signal gives you this status? If you provide this si...

plus de 9 ans il y a | 0

Réponse apportée
How can I import a file that includes both string and numerical data?
fid=fopen('file.txt') s=textscan(fid,'%s','headerlines',1,'delimiter','\n') fclose(fid) out=[s{:}] out=out([1 5:en...

plus de 9 ans il y a | 0

Réponse apportée
save a matrix to excel
xlswrite('filename.xlsx',yourmatrix)

plus de 9 ans il y a | 21

Réponse apportée
How can I combine 100+ matrices into a combined array for indexing
Use cell arrays M={A1,A2,A3,A4,A5} save filename M To get the matrix for project N°5 A=M{5} Since your matrices...

plus de 9 ans il y a | 1

| A accepté

Réponse apportée
how to generate a RANDOM matrix of 0's and 1's such that the number of 1's in any column is the same.
n=6 m=2 A=zeros(n) A(cell2mat(arrayfun(@(x) randperm(n,m)+6*x,0:n-1,'un',0)))=1

plus de 9 ans il y a | 0

Charger plus