Answered
fusing two cell array columns into one
cellfun(@(x,y) [x ' ' y],x1,x2,'un',0)

10 years ago | 1

| accepted

Answered
How to replace some elements from a vector using if
[~,jj]=unique(L) out=X; out(jj(2:end))=0

10 years ago | 0

Answered
I want to copy values from one variable to another
V=[0 1 2 4 5 6 7 9 10 11 52 10 2 0 60 4 0 407 0 7 70]; M=[V(1:end-2)' V(2:end-1)' V(3:end)']

10 years ago | 0

Answered
Index exceeds matrix dimensions
Check the sizes of the variables face1 and face2

10 years ago | 0

Answered
How do I plot first order function? New to Matlab
x=0:0.01:20 y=3*x+2 plot(x,y) Or use fplot y=@(x) 3*x+2; range=[0 20]; fplot(@(x) y(x),range)

10 years ago | 0

| accepted

Answered
transforming minutes into time
a=[90;990;;1117;54;60] h=fix(a/60) m=mod(a,60) out=arrayfun(@(x,y) [sprintf('%d',x) ':' sprintf('%d',y)],h,m,'un',0) k=dat...

10 years ago | 1

Answered
Saving Loop Variables into Different Column
T{i}=mean(Cr)

10 years ago | 0

| accepted

Answered
addressing a cell array
s={1 'rt';2 'er';3 'tr';4 5 ;8 'zz';9 1} a=s(:,2) idx=cellfun(@(x) isequal(1,x),a)

10 years ago | 0

| accepted

Answered
How should I write this fprintf in order for it to work?
lambda=2; fprintf('%%%%%%%%%% lambda=%d %%%%%%%%%% \n',lambda) The number of % should be even. Because to display the sp...

10 years ago | 1

Answered
How to multiply all elements of matrix
prod(nonzeros(A(:)))

10 years ago | 2

Answered
How to define a single row in a vector
A(6,:) <http://www.mathworks.com/help/matlab/learn_matlab/array-indexing.html>

10 years ago | 0

| accepted

Answered
Since the index must be positive integer, how to run a for loop that needs to use index that occurs before the initial value?
Using fake data, you will get fake result! Look at this example % y(k)=y(k-1)-y(k-2), with y(-1)=5; and y(0)=4; % how to u...

10 years ago | 0

Answered
Change a 3D matrix to a stacked 2D matrix
out=reshape(permute(a,[2 1 3]),size(a,2),[])'

10 years ago | 1

Answered
In an assignment A(I) = B, the number of elements in B and I must be the same error.
load error_matrixes for i=1:numel(Full_Result.Nodes_Names) I=strcmp(Full_Result.Nodes_Names{i, 1},Network.Nodes); ...

10 years ago | 1

| accepted

Answered
Is it possible to Mute warnings from a specific subsystem of a simulink model
<http://www.mathworks.com/matlabcentral/answers/98506#answer_107855>

10 years ago | 0

Answered
./ meaning in Matlab
[1 2 3]./[10 20 30] The result is [1/20 2/20 3/30] You can also do the element wise multiplication [1 2 3].*[10...

10 years ago | 1

| accepted

Answered
want to know fuction(matrix's all element plus)
sum(A(:))

10 years ago | 0

Answered
State space in simulink
Let us take a third order SISO system, The output y=C*[x1;x2;x3]. If you have C=[ 2 4 1] If you want to see the 3 state...

10 years ago | 1

| accepted

Answered
Why we use Transfer Function to represent/describe a Dynamic Model?
<http://www.mathworks.com/help/ident/ug/what-are-transfer-function-models.html>

10 years ago | 0

Answered
How to save figure
for k=1:3 filename=sprintf('picture%d.jpg',k) saveas(gcf,filename) end

10 years ago | 0

Answered
How to generate random numbers?
l1=10; l2=50; out=l1+(l2-l1)*rand(1,5); out=round(out*100)/100

10 years ago | 1

Answered
Get specific elment of result / solution vector
If you want it in one line temp = A\b;x = temp(end); Otherwise you can't do it

10 years ago | 0

Answered
How to solve rms calculation problem ?
The rms function requires a signal processing toolbox

10 years ago | 0

| accepted

Answered
How can I read variable textfiles?
You can use importdata D=importdata('fileName.txt') N=D.data

10 years ago | 0

| accepted

Answered
Extract column 1, 4-6, 8 of an 8x8 matrix
A(:,[1 4:6 8])

10 years ago | 1

| accepted

Answered
how to tick out yearly?
Look at this example d=datenum('01-01-2015'):datenum('01-01-2035'); y=log(d); plot(d,y) a=datevec(d); [ii,jj]=unique(a(...

10 years ago | 1

| accepted

Answered
I am trying to read and convert this textfile into a cell array, help!
FileID = fopen('data1.txt') s = textscan(FileID,'%s'); fclose(FileID) out=reshape([s{:}],2,[])

10 years ago | 1

Answered
How to I find a value contained in a known index of a matrix?
A(3,1) read the documentation <http://www.mathworks.com/help/matlab/learn_matlab/array-indexing.html>

10 years ago | 0

Load more