Answered
How to convert from a for loop to a while loop
Don't use the variable i, it's used by Matlab to represent complex numebers ii=3 while ii<n x = [1:ii]; y = x.^2...

11 years ago | 0

Answered
Add directory path to fopen
file=fopen(fullfile(pwd,FileName),'wt')

11 years ago | 0

| accepted

Answered
How to delete a row with specific letter
A(ismember(A(:,1),'K'),:)==[]

11 years ago | 0

Answered
Rounding Vector Entries with zeros after the decimal place to integers
sprintf('%d\n',T) or out=num2str(T)

11 years ago | 0

Answered
How to convert a vector to a matrix in Matlab?
a=[1 2 3 4 5 6 7 8 9] reshape(a,3,3)

11 years ago | 0

| accepted

Answered
I have a string S='010101' I need to take each element from the string and check whether it 1,if it is one then the count is incremented by one in matlab?
S='010101' out=nnz(S-'0') To correct your for loop St='010101'; count=0; a=0; for i=1:6 a=St(i); if(a=='1')...

11 years ago | 0

| accepted

Answered
Performing equations on individual elements of a 3D Matrix, and then summing that along the z column
A=randi(10,4,3,2) % Example of your matrix result out=sum(A,3)

11 years ago | 0

Answered
How to plot a chart(e.g bar chart) given a dublicate x values?
time_duration=[2 4 3 6 7 3 7] Altitude=[20 30 40 50 60 60 50] [unique_time_duration,jj,kk]=unique(time_duration) new_Al...

11 years ago | 0

Answered
I would like axis off except xlabel, but this is not working, why?
set(gca,'xtick',[],'ytick',[],'title',[],'ylabel',[]),

11 years ago | 1

Answered
How to use really small dots in scatter plots?
h=plot(1:10,1:10,'.'); set(h,'markersize',4)

11 years ago | 1

Answered
Write Tabular Data to Text File Write a short table of the exponential function to a text file called exp.txt.
*Edit* A = input('Enter A: '); B = input('Enter B: '); func = @(x) exp(x)-2*cos(x); e = 1; fileID=fopen('fic.txt','w')...

11 years ago | 0

Answered
How to run a program for three different values
temp= [30,40,50] for k=1:numel(Temp) T=temp(k) % add your ptogramme end

11 years ago | 0

| accepted

Answered
How to display a matrix as a image ?
A=randi([-1 200],120,50) map=[0 0 0;1 1 1;1 0 0]; idx1=A==-1 idx0=A==0 idx2=A>0 A(idx1)=1 A(idx0)=2 A(idx2)=3 image(A)...

11 years ago | 0

| accepted

Answered
How can I determine if specific cells within an array are empty?
That means edgeXPlus is not a cell array. Use edgeXPlus(1) instead of edgeXPlus{1}

11 years ago | 0

| accepted

Answered
Filling different size vectors with NaN
v=[1;2;3;4] j=[5;6] n=max(numel(v),numel(j)) v(end+1:n)=nan j(end+1:n)=nan

11 years ago | 7

| accepted

Answered
Find index between two vectors
A=[2015 1 1 14 59 0 2015 1 1 15 0 0] idx=find(A(:,4)==14 & A(:,5)=59) or idx=find(ismember(A(:,4:5),[14 59],'rows'...

11 years ago | 2

| accepted

Answered
Legend on MATLAB FIGURES
t=0:0.1:10; y1=sin(t); y2=cos(t); plot(t,y1,t,y2); leg={'leg1','leg2'}, hleg=legend(leg); set(hleg,'fontsize',6)

11 years ago | 0

Answered
Correct use of Semilogx
set(gca,'xscale','log')

11 years ago | 0

| accepted

Answered
Extracting data from multiple files with header.
f=dir(fullfile(YourFolder,'*.txt')); files={f.name} for k= 1:numel(files) fid = fopen(fullfile(YourFolder,files{...

11 years ago | 0

| accepted

Answered
Create a Pause Button
Use pause function

11 years ago | 0

| accepted

Answered
how convert 13 digits of timestamp?
use format short or s=1238536800000 fprintf('%6.6g\n',s)

11 years ago | 0

Answered
Problem in reading binary data from excel file
1.0001e+21 is not also a binary number. Before importing your xlsx file, change the format of your cells to text.

11 years ago | 0

Answered
How can I sum an expression over the indices of an array?
A=[1, 2, 3, 4]; syms x out for y=2:numel(A) out(y-1)= sum(A(y)-A(y-1:-1:1))*x end

11 years ago | 0

Answered
problem with datenum: it does not return the same number for the same date
If we check this, there is no problem s={'09/10/2008' '09/10/2008' '10/10/2008' '10/10/2008' '13/10/2008' ...

11 years ago | 0

Answered
Trying to remove range of negative numbers from a specific column of multiple rows
dlen = 18*fix(length(Glxc{:})/18); % Set Row Length Glxcr = reshape(Glxc{:}(1:dlen), 18, [])'; ...

11 years ago | 0

| accepted

Answered
plot 3D surface for this function: X=F(phi,beta,rho) Y=F(phi,beta,rho) Z=F(phi,beta,rho)
phi1=-pi/2:0.01*pi:pi/2; phi2=-pi/2:0.01*pi:pi/2; phi3=-pi/2:0.01*pi:pi/2; X=0.4*cos(phi1).*sin(phi3)+0.4*sin(phi1).*cos(ph...

11 years ago | 0

Answered
Matrix with at most one 1 per row
A=zeros(4) n=size(A,1) idy=randperm(n) idx=1:n idxy=sub2ind(size(A),idx,idy) A(idxy)=1 If the matrix is not square ...

11 years ago | 0

| accepted

Answered
How to get most similar row in matrix A to matrix B
a = sum(abs(bsxfun(@minus,A,B)),2) [~,t] = min(a); out1 = A(t,:)

11 years ago | 0

Answered
How to change Horizontal size of a Constant block based on the "Value" of the block in order to make the value visible
If you don't want to change the position of your block. Get it's actual position pos=get_param('ModelName/Constant','Positi...

11 years ago | 0

Load more