Answered
How can I split two side-by-side vectors into many individual vector pairs?
M = [ 1 3 NaN 7 9 ]; N = [ 0 2 4 6 NaN ]; idx=any(isnan([M;N])); out=arrayfun(@(x,y) [x y],M,N,'un',0) ; out(idx)={nan}

13 years ago | 0

| accepted

Answered
Time to run programming
Use tic %your code toc

13 years ago | 0

Answered
find summation of all the element in the matrix
sum(cmap(:))^2

13 years ago | 0

| accepted

Answered
find luminance vector in an image
If Im is your nxmx3 rgb image yi=Im(:,:,1)*0.299+Im(:,:,2)*0.587+Im(:,:,3)*0.114

13 years ago | 0

| accepted

Answered
read matrix from .txt
M=dlmread('filename.txt')

13 years ago | 4

| accepted

Answered
Subscript indices must either be real positive integers or logicals.
In windows command type which length what did you get? I guess you get: length is a variable

13 years ago | 1

| accepted

Answered
it is posible to auto fit all blocks in a simukink file from matlab code?
set_param('yourmodel/yourblock','position',[x0 y0 xwidth yheight])

13 years ago | 0

| accepted

Answered
how can i display 5 row lines of pixel values ?
Im(1:5,:,:)

13 years ago | 0

Answered
Assign values to elements of a matrix with indices less than those specified in an array
Not the best solution, but it should work A=[2,4,1,3] B=zeros(max(A),numel(A)) idx=cell2mat(arrayfun(@(x) sub2ind(size(B)...

13 years ago | 0

| accepted

Answered
Copy matrix into N Dimensional array
Do you mean? R1=rand(18,9) % Example R2=reshape(repmat(R1,1,6),18,9,6)

13 years ago | 0

| accepted

Answered
How to Search images Automatically from "My Pictures " folder
I don't know what you mean by search. To import your image from a specific folder folder='C:\Users\pc\Pictures' filename='...

13 years ago | 1

Answered
Why do I have differnt answers every time!
Start your code with clear T % Or better, pre-allocate T=zeros(6,50)

13 years ago | 0

Answered
How to randomly repeat an array elements?
P = [1, -1, j, -j]; a=perms(1:4); id=randi(size(a,1),4,1); idx=a(id,:); out=P(idx(:))'

13 years ago | 1

Answered
Unable to locate a C-compiler required by Stateflow and MATLAB Function blocks. Use 'mex -setup' to select a supported C-compiler.
*mex -setup* locate compilers if there are any! This is what we check at first. If none of the compilers are found you have to ...

13 years ago | 0

Answered
How can i use sym2polys function?
It's |sym2poly| (without s) Before asking in the forum, read the help help sym2polys doc sym2polys %or in the net...

13 years ago | 0

| accepted

Answered
i want produce a random number between 2 and 10 for example...
2+rand*(10-2)

13 years ago | 0

| accepted

Answered
i want select the first and second array s(i) in the loop
Just create a new counter and a new variable to store your data. At the end of yourloop add new_var(k,1:2)=s(1:2)

13 years ago | 0

| accepted

Answered
how rearrange data in a matrix?
data=[1 2 3 4 5 6 7 8]; n=numel(data); R=zeros(n/2,n); R(:,1:2)=reshape(data,2,[])'; out=cell2mat(arrayfun(@(x) circshift(...

13 years ago | 1

| accepted

Answered
dividing a circle into equal n parts and then generate random point inside each part
x0=2; y0=1; r=1; teta=-pi:0.01:pi; x=r*cos(teta)+x0 y=r*sin(teta)+y0 plot(x,y) hold on scatter(x0,y0,'or') axis squar...

13 years ago | 2

| accepted

Answered
How to send data to a embedded matlab fn block from simulink model
Read this link <http://www.mathworks.com/help/simulink/slref/matlabfunction.html>, you can see an example. For your case you hav...

13 years ago | 0

| accepted

Answered
assembling a correlation matrix
You can change your function function ret=hsum(x,y,C,G,M,N) a=C(1:M,1:N); b=G(1:M,1:N); ret=sum(find(C==x and G==y)); ...

13 years ago | 0

Answered
Can help me create a selection sort function? I understand how it works but I cant come up with a code that works.
Look at this line m = k; if x(k) < x(m) this expression is always false, which means your code does nothing Also w...

13 years ago | 0

Answered
How to solve these ode45 errors?
Change the last line, it should be a column vector att2 = [Eq1 ;Eq2];

13 years ago | 1

| accepted

Answered
how can concat cell array with array?
s=[s num2cell(yourarray)]

13 years ago | 0

Answered
Stairs Command MATLAB Ends
x=1:10 y=[0 1 0 1 0 1 0 1 0 1] stairs(x,y,'k') hold on scatter(x,y,'or','linewidth',2) %you can also change ylim ...

13 years ago | 0

Answered
how do i sort cell array
If a is your cell array b=reshape(a,numel(a)/2,2)' out=b(:)

13 years ago | 1

| accepted

Answered
How to do frequency scaling/averaging using matlab?
Maybe you want interpolation f=[14290.218, 14289.593, 14288.969] intensity=[4 10 20] fi=[14290,14289,14288] intensity_ne...

13 years ago | 0

| accepted

Load more