Answered
get rid of empty spaces in cells containing strings
str={'103';'114';' 25';' 9';' 13';' 8';' 12';' 26'} out=strtrim(str)

10 years ago | 3

| accepted

Answered
may i ask how to sort the row of matrix in large data?
a=[10 20 4 5] idx=[2 1 3 4] out=a(idx)

10 years ago | 0

Answered
how to count number of states in sequence?
a=[1,3,3,1,2,1,4,2,3,1,4,2,4,4,4,3,1,2,5,1] out=unique(a) number_of_states=numel(out)

10 years ago | 0

Answered
How can I change the place of two numbers randomnly in a row?
[n,m]=size(a), out=a(reshape(randperm(n*m),n,m))

10 years ago | 0

Answered
I have an array of date time values. How do I separate Date and time and enter it in separate columns in excel?
v={'19-Apr-2016 11:29:31' '27-Apr-2016 00:05:59' '31-Mar-2016 18:35:46'} w=regexp(v,'\s+','split') out=reshape([w{...

10 years ago | 1

Answered
Find a row number in a table?
t1=cell2table(num2cell(randi(2,10,3))) t2=cell2table(num2cell(randi(2,14,3))) n=min(size(t1,1),size(t2,1)) a1=t1{1:n,:} a2...

10 years ago | 0

Answered
How I can add marker names with plot function?
for k=1:numel(station_id) text(lon(k)+0.5,lat(k),station_id{k}) end

10 years ago | 0

| accepted

Answered
How can i display a vector as a result of a for loop ?
mk=mn'; remove the semi colon mk=mn'

10 years ago | 0

Answered
How to save matrix created in loop
B{i}=a(randperm(k),:);

10 years ago | 0

Answered
how to create a binary random matrix
randi([0 1],4,2)

10 years ago | 0

Answered
starting location of vector
g = [ 1 1 1 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 ] [~,~,ii]=unique(cumsum(g).*not(g)) d=accumarray(ii,(1:numel(ii))',[],@(x) {x})...

10 years ago | 0

Answered
getting it in a matrix?
reshape(A,20,[])'

10 years ago | 0

Answered
Removing duplicate rows (not "unique")
A=randi(5,10^5,3); tic A=unique(A,'rows'); toc The result Elapsed time is 0.171778 seconds.

10 years ago | 1

Answered
Attempted to access stepcount(0); index must be a positive integer or logical.
stepcount(count) gives an error because count is initialized to 0

10 years ago | 0

Answered
difference between load and xlsread
You will find all what you want in the documentation: <http://www.mathworks.com/help/matlab/ref/load.html> <http://www.mathwo...

10 years ago | 0

Answered
flip half of matrix over the diagonal to make a symmetric matrix
A=[1 0 0 0 2 3 0 0 4 5 6 0 7 8 9 10] [n,m]=size(A); B=A'+A B(1:n+1:end)=diag(A)

10 years ago | 3

| accepted

Answered
change position of axes in graphical output
instead of using plot(x,y) use plot(y,x), or (scatter).

10 years ago | 1

| accepted

Answered
big matrix-out of
<http://www.mathworks.com/help/matlab/matlab_prog/resolving-out-of-memory-errors.html>

10 years ago | 0

Answered
store images in a table
Do you mean how to store them in a cell array? dinfo = dir('*.jpg'); n=numel(dinfo); T=cell(n,1); for K = 1 : n fil...

10 years ago | 1

Answered
How to multiply a vector of symbolic variables by a 3D matrix, for supplying to cvx?
y=sym('y',[1,3]) A=randi(4,5,5,3) out=zeros(size(A,1),size(A,2)) for k=1:size(A,3) out=out+y(k)*A(:,:,k) end

10 years ago | 0

Answered
Naming a loop?
You can use functions <http://www.mathworks.com/help/matlab/ref/function.html>

10 years ago | 0

Answered
how to get 10 decimal values in matlab results when in using search space expansion scheme
format long or your_number=1/3 sprintf('%.10f',your_number)

10 years ago | 0

Answered
Permutations of string without repetitions
str='ABA' out=unique(str(perms(1:numel(str))),'rows')

10 years ago | 0

Answered
Adding datestr to filename producing odd results
Run=37 A1 = Run; %in this case I'd declared it to be 37 A2 = datestr(now, 'ddmmmyy') str=sprintf('Run_%d_%s.xlsx',A1,A2) ...

10 years ago | 0

| accepted

Answered
what's the black bar in simulink?
This is probably a Mux block <http://www.mathworks.com/help/simulink/slref/mux.html>

10 years ago | 0

Answered
To find the number of sections with negative values
a=rand(100,3)-0.6 % Example c3=a(:,3); dd=(c3<0)'; f=cumsum(~dd)+dd(1); ff=f.*dd [~,~,kk]=unique(ff) id=accumarray(kk,(...

10 years ago | 0

Answered
How can I cut the half of Structure?
n=fix(numel(mmm)/2) mmm1=mmm(1:n) mmm2=mmm(n+1:end)

10 years ago | 0

| accepted

Answered
scaling down 0x axis coordinates of a graphic
Look at this example t=0:100; y=sin(t); plot(t,y) xl=xlim; xtn=0:0.125:1 set(gca,'xtick',linspace(xl(1),xl(2),numel(xt...

10 years ago | 0

Answered
How to copy an array with some left-over indicies also added on?
You can use repmat a = [1;2;3;4;5] b=[repmat(a,3,1); a(1:3)]

10 years ago | 0

| accepted

Load more