Answered
Function to capitalize first letter in each word in string but forces all other letters to be lowercase
str='this is a tEST'; str=lower(str) idx=regexp([' ' str],'(?<=\s+)\S','start')-1 str(idx)=upper(str(idx))

13 years ago | 2

| accepted

Answered
How can i see the element of the a cell element of 8*8*8?
a=A{159}; out=sum(a(:))

13 years ago | 0

Answered
Search in array with sequence
y='00110011100001110011' ii={'' '5' '6'} out=char(ii(cellfun(@numel,regexp(y,'1+','match'))))' %or y='00110011100001...

13 years ago | 0

| accepted

Answered
Error using Plot. Vectors must be the same length
This line is not correct plot(firs4, title('step 4')) Replace it by plot(firs4) title('step 4'))

13 years ago | 0

Answered
matrix and vector multiplication without for loop
n=4; m=3; X=rand(m,n); % Example Y=rand(m,1); G=sum(bsxfun(@times,X,Y))'

13 years ago | 0

Answered
if at least one number >
A=[ 11 12 17] number=13; W={}; if any(A>number) W{1}=A; end

13 years ago | 0

| accepted

Answered
Date time conversion 24
d='01:30 PM' new_d=datestr(datenum(d,'HH:MM AM'),'HH:MM')

13 years ago | 1

Answered
about axis ticks: how to set 10 ticks with 5 labels?
x=1:10; y = x; plot(x, y) ylim([0 10]) set(gca,'YTick', 1:1:10, 'YTickLabel', {'' '2' '' '4' '' '6' '' '8' '' '10'} );

13 years ago | 0

| accepted

Answered
how do i jump to a previous line in a matlab program
I am not sure that your code converge, maybe you want clc tini=[21;26;29;30;23]; minx=10; while minx>=1 x= [1,2,3,0...

13 years ago | 0

Answered
Basic Vectorization Question (speed required)
Z = rand(5,100); %matrix of data IDY = randi([1 5], [1,100]); %index into that matrix X = NaN(size(Z,2),1); %pre allocate X...

13 years ago | 0

| accepted

Answered
subtract two parameters with diff dimension
The size of Y is greater then the size of X, we can subtract the first 100 rows, but what about the remaining rows in Y? Look at...

13 years ago | 0

| accepted

Answered
How do i count the no of ones of 3D matrix?
If A is your array no1=sum(A(:)) For second question A=rand(272,272,272); idx2=8:8:272; idx1=[1 idx2(1:end-1)+1];...

13 years ago | 0

| accepted

Answered
Compare matrix column-wise with vector
mask=bsxfun(@lt,mat,minVec)| bsxfun(@gt,mat,maxVec)

13 years ago | 4

| accepted

Answered
concatenate a double to a cell
a={1 2 3;4 5 6} b=[5 8 12] out=[a;num2cell(b)]

13 years ago | 0

| accepted

Answered
Different start and stop time within a system in Simulink
Try <http://www.mathworks.com/help/simulink/ug/enabled-subsystems.html Enabled Subsystem>

13 years ago | 0

| accepted

Answered
shift a plot in the vertical direction?
k=2 plot(y+k) %or plot(x,y+k)

13 years ago | 1

Answered
add numbers to array
z=[3 9 16 25 36 54 67 91] Look at doc array

13 years ago | 0

Answered
How can I save a MATLAB generated data in MS EXCELL
Use xlswrite function

13 years ago | 0

| accepted

Answered
how to show result in array
a=[1 2 3 4] k=a-1

13 years ago | 0

| accepted

Answered
SUBSTRINGS CREATION WITH DIFFERENT ORDER
s =[ 0 1 1 0 1 1 0 1 0 0 0 1 ]; n=6; m=numel(s)-n+1; A=zeros(m,n); idx=cell2mat(arrayfun(@(x) x:x+n-1,(1:m)','un'...

13 years ago | 0

| accepted

Answered
Plot a Curve and choose random points on it
Example x=0:10 y=sin(x) n=numel(y) random_samples=y(randperm(n,randi(n)))

13 years ago | 0

| accepted

Answered
find closest Coordinates to a point
A = rand(1,2); B = rand(10,2); dist=bsxfun(@hypot,B(:,1)-A(1),B(:,2)-A(2)); out = B(dist==min(dist),:)

13 years ago | 2

Answered
Load txt data into popupmenu
a=num2cell((1:5)') set(handles.popupmenu1,'string',a)

13 years ago | 0

| accepted

Answered
How to change output value from simulink logic blocks
You can use switch block <</matlabcentral/answers/uploaded_files/4845/ansp1.png>> or you can use compare to constant blo...

13 years ago | 0

| accepted

Answered
Trouble with Matrix Dimensions
Use operation element by element |.*| velx = -r*sin(a) - L*(asin((r/L)*sin(a))).*(acos(((r/L)*sin(a)).*((r/L)*sin(a))))

13 years ago | 0

| accepted

Answered
matrix creation simulink block
t=0:100 % time vector y=sin(t) % your signal ty=[t' y'] Use a <http://www.mathworks.com/help/simulink/slref/fromworks...

13 years ago | 0

Answered
what does == mean in script
a==b returns 1 if a and b are equal, it returns 0 if not. type 1==4 % check the result 4==4 % check the result

13 years ago | 3

Answered
Embedded MatLab Function Errors
In configuration parameters, just choose a discrete solver

13 years ago | 0

| accepted

Answered
Possibility of multidimensional arrays multiplication
sum(bsxfun(@times,A,b),3)

13 years ago | 0

| accepted

Load more