Answered
Comparing cell arrays for same values?
*Edit* X={'A' 'B' 'C' 'A' 'C' 'D' 'A' 'D' 'G' 'A' 'E' 'H' 'Q' 'N' 'J' ...

13 years ago | 0

| accepted

Answered
How to remove Nans from matrix
out=reshape(M(~isnan(M)),[],size(M,2)) Edit M can not be reshaped unless we add some nan at the end of M %---------...

13 years ago | 1

| accepted

Answered
easily sub dividing image into blocks
im=rand(256); [n,m]=size(im); p=4 aa=1:p:n bb=1:p:m [ii,jj]=ndgrid(aa,bb) out=arrayfun(@(x,y) im(x:x+p-1,y:y+p-1),ii,jj,...

13 years ago | 1

| accepted

Answered
how to use a while loop to solve this?
An example how the while loop works If we have to do 1+2+3+4+...+10 s=0; k=0; while k<10 k=k+1; s=s+k en...

13 years ago | 0

| accepted

Answered
defining a variable in matlab
h=0:0.1:10 r=5 V= (pi*h.^2/3).*(3*r-h) plot(h,V)

13 years ago | 0

Answered
ROC from Z transformation
If you want to get the ROC, you have to do it manually. there is nothing reafering to region of convergence in ztrans function ...

13 years ago | 0

Answered
how do I save a double array in matlab to file as full precision double numbers?
a=[0.005000000000000 0.005008727005636 0.005034902724414 0.005078511265159 0.005139526153297] b=spri...

13 years ago | 1

Answered
symbolic z transform answer to transfer function
syms n z x2_n = (1+n+n^2); m=ztrans(x2_n); h=collect(m); [ii,jj]=numden(h); num=sym2poly(ii); den=sym2poly(jj); ts=1...

13 years ago | 1

| accepted

Answered
re arrange/shape matrix according to the position of a index value in array.
% If |your_array| is your cell array [a,b]=unique(your_array(:,1),'stable'); n=size(your_array,1)/numel(a); zz=reshape...

13 years ago | 0

| accepted

Answered
How can I determine if a directory is on the MATLAB path programmatically?
isdir('your_folder_name')

13 years ago | 0

Answered
Create a vector name from two integer variables
This is a vector of names out={}; for k=1:5 for p=1:5 out{end+1}=sprintf('vector%d%d',k,p) end end

13 years ago | 0

Answered
problem of for loop
If you mean to sum all the values use for k=1:10 x(k)=sin(k) end out=sum(x) %or without a for loop k=1:10 x...

13 years ago | 0

| accepted

Answered
Need Help- .txt to array values
You can use v=dlmread('file.txt') %or v=importdata('file.txt') %or fid=fopen('file.txt'); v=cell2mat(texts...

13 years ago | 0

Answered
Substituting values to/from a cell array
a={4 1 3 5; 5 5 1 4} b={5 1 3; 1 3 4} a(:,2:4)=b(:,1:3)

13 years ago | 1

| accepted

Answered
take the execution to the specific line in matlab code
There is no goto instruction in Matlab. But you can avoid using it by using while loop if else if break continue You...

13 years ago | 0

Answered
Delete array element values from another array element values
setdiff(Z,A)

13 years ago | 18

| accepted

Answered
Ones matrix size limit?
<http://www.mathworks.com/support/solutions/en/data/1-IHYHFZ/index.html>

13 years ago | 1

Answered
Function definitions are not permitted in this context??
function dydt = Problem4(t,y) dydt = y*t^3-1.5*y; % save this function as Problem4.m In another m file or in Matlab win...

13 years ago | 0

Answered
How to plot an Ellipse
a=5; % horizontal radius b=10; % vertical radius x0=0; % x0,y0 ellipse centre coordinates y0=0; t=-pi:0.01:pi; x=x0+a*cos...

13 years ago | 30

Answered
Hi, How to write the code with random number of iterations?
You can do it using eval function d=10 n=5 out=0 s1=sprintf('for k%d=1:%d,',[1:n;repmat(d,1,n)]); % The n first for loop...

13 years ago | 0

Answered
controlling array data when calculating
a = 10; w = -a:a/1000:a; F = 2*sin(a*w)./w; tol=0.01 idx=find(abs(F)<tol) [w(idx)' F(idx)']

13 years ago | 0

Answered
how to save a matrix that contains NaN, strings and numbers
out={10 20 nan 'str' [1 2] [1 0;2 4]} You can save your data in a mat file: save filename out

13 years ago | 0

| accepted

Answered
Simulink reading mat file issue
Some of your data are equal to nan, load your mat file, make interpolation to replace those nan values, and save again your new ...

13 years ago | 0

Answered
question on generating random numbers
k=100 % number of random arcs out=arrayfun(@(x) sort(randperm(11,randi(10)+1)-1),1:k,'un',0); celldisp(out)

13 years ago | 0

| accepted

Answered
how to plot in two axes
plot(x,y) % x and y should have the same number of element If you want to plot on axes1 plot(handles.axes1,x,y)

13 years ago | 0

Answered
Read text file and store in .mat file
fid = fopen('file1.txt'); A= textscan(fid,'%s'); fclose(fid); celldisp(A) save file2 A

13 years ago | 1

| accepted

Answered
question of applying sum() to the matrix with zero values
You've probably used sum as a variable in your code. Try this clear sum X=[1 0 0 ;0 0 0;0 9 0] sum(X)

13 years ago | 1

| accepted

Answered
merging two matrices (cell matrices)
AA={1 2 3;4 5 6;7 8 9} BB={10 nan 2;nan 5 55;nan 44 66} CC=AA CC(cellfun(@isnan,BB))={nan}

13 years ago | 0

| accepted

Answered
stopping matlab from re-formating my numbers!!!
x = 110.01001 a=sprintf('%.5f',x)

13 years ago | 0

Load more