Answered
Add legend to scatter
legend('I_K','U_L','Location','Best');

13 years ago | 1

| accepted

Answered
How to avoid a loop using vectors?
h=(10^-1).^[1:8]; x=pi; r=5e-6.*rand(1,16); fminush1=cos(x-h)+r(1:8); fplush1=cos(x+h)+r(9:16) fder=(fplush-fminush)./(2*...

13 years ago | 0

Answered
How to use 'dir' to list files in another directory with a string
x='E:matlab' d = dir(x) f={d.name}

13 years ago | 0

Answered
How to ascertain number of special characters in a string?
s={'abc/d?' 'abcd' 'Abc123\'} out=cellfun(@numel,regexp(s,'[^a-zA-A0-9]+','match'))

13 years ago | 0

Answered
Why does the sum of S1 AND S2 ?
Maybe you want S1=[23.6000 58.4000 47.4000 101.7000 29.9000 36.8000] S2=[23.6000 58.4000 47.4000 67.1000 ...

13 years ago | 0

Answered
Appending vector in long for-loop
out=zeros(1,62012*10); n=0; while y < x n=n+1; for k=1:10 out(1,k+(n-1)*10)= percentChange(avgLine(y-9), ...

13 years ago | 0

Answered
How to replace a word with an integer?
A(cellfun(@(x) ~isempty(strfind(x,'NoValue')),A))={0} % A is your cell array %or A(strcmp(a,'NoValue'))={0} ...

13 years ago | 0

Answered
How to rearrange variables in an equation
syms wT m2 a1 a2 m1 H=wT*(1- (1+(m2*a1)/(m1*a2))/(1+(m2/m1)*(a2/a1)^.5)) sol=solve(H,a1)

13 years ago | 0

Answered
Z must be size 2x2 or greater. HELP
T5 should have the same size as kRx and kRz

13 years ago | 0

Answered
Stacking matrices in a larger matrix in a loop
out=zeros(36,4) % Pre-allocate for k=1:4 A=rand(9,4); out((k-1)*9+1:k*9,:)=A end

13 years ago | 0

Answered
please help me ode45 problem undefined argument
Save this function as fun.m and do not forget to add the missing values of t and tw function xdot=fun(t,x); tw=? f=? xd...

13 years ago | 0

Answered
printing a cell matrix to a text file
fid=fopen('filename.txt','w') for k=1:size(C,1) fprintf(fid,'%s %d %d %s\r\n',C{k,:}) end fclose(fid)

13 years ago | 0

| accepted

Answered
Index expression out of bounds. Attempted to access element 2. The valid range is 1-1.“2”
Check the sizes of ii and I, check also if all values in ii are positive integer

13 years ago | 1

Answered
Undefined function or variable 'm'
The for loop m=0 for i=1:256 for j=1:256 m=m+double(i).*p(i,j); end end can be replaced by m=sum(su...

13 years ago | 0

Answered
Simulink Converting Row Vectors to Column Vectors
If you are using a constant bllock, uncheck |interpret vector parameters as 1-D|

13 years ago | 1

| accepted

Answered
Saving the variables in a function call and using them next time the same function is called
k=1 [dx,dy,AF]=youy_fcb(~) A(k,:)=[dx dy AF]; k=k+1 [dx,dy,AF]=youy_fcb(~) A(k,:)=[dx dy AF]; d=A(end,:)-A(en-1,:) dx=d...

13 years ago | 0

Answered
how to plot a graph from the results of for loop
plot (p,A,'o'); hold on

13 years ago | 0

| accepted

Answered
Remove NaNs in matrices within cell array
out1=arrayfun(@(x) A(~isnan(A(:,x)),x),1:size(A,2),'un',0)

13 years ago | 1

Answered
Matlab gives different results summing a few numbers with and without parentheses
Read this <http://matlab.wikia.com/wiki/FAQ#Why_is_0.3_-_0.2_-_0.1_.28or_similar.29_not_equal_to_zero.3F>

13 years ago | 0

| accepted

Answered
Pre-allocate memory gives zeros all the time, how to avoid?
In your Matlab function, declare a variable arr as persistent persistent arr if isempty(arr) arr=zeros(5,4) end ...

13 years ago | 0

Answered
How to sort values and strings
Stations={'a';'b';'c'} depth=[1;3;2] height=[3;1;2] v=[Stations num2cell([depth height])] sortrows(v,2) % depth is in the...

13 years ago | 0

| accepted

Answered
How do I use REGEXP to match multi-digit values?
str = 'Part ID: 112 or Part ID: 220 or Part ID: 252 or Part ID: 106'; exp = '(?<=Part ID:) 220'; m = regexp(str, exp, 'match...

13 years ago | 0

| accepted

Answered
How to calculate no. of pixels having value greater than a particular RGB value?
idx=pic>180 out=sum(idx(:))

13 years ago | 3

Answered
Script work - hard to explain in title
A=[2, 3, 5, 7] cumsum(fliplr(A))

13 years ago | 0

| accepted

Answered
How to fix this. Please help!
This line |A1= interp1( t , A, t1 , 'nearest')| is not correct, |t| is not defined, use A1= interp1( time , A, t1 , 'neare...

13 years ago | 0

| accepted

Answered
How to calculate the sum of each row in a matrix?
A=[2 4 4 6 7 1 2 3 4 5 1 2 3 4 5 1 2 4 5 6] out=sum(A,2)

13 years ago | 13

| accepted

Answered
Error using cos Not enough input arguments. HELP
You missed something in |cos.*| ,maybe you want z = cos(x).*((x).*sin(y)).*((1-3.*cos((y).^2))-(x.^2).*sin((y).^2)).*cos(...

13 years ago | 1

| accepted

Answered
Replacing one value in a for loop
Use circshift function a=[1 0 0 0]; for k=1:3 b=circshift(a,[0 k]) %your code end

13 years ago | 0

Answered
In an assignment A(I) = B, the number of elements in B and I must be the same.
When you wrote |pwave(counter) = peaks(i);| , *peaks* is not defined Also |a = length(peakwaves);| is an integer, What |[0.3...

13 years ago | 0

Load more