7,152 total contributions since 2012

University teacher

Speciality: Automatic control

Hobbies: Football, Music and Chess.

Professional Interests: Automatic Control

https://www.youtube.com/channel/UC3moae2VIQIKNfDw5bYAAUg/videos

Answered

How to convert a 1x1 cell to a string?

To convert a cell array of character vectors to a character array, use the “char” function. A = {'line'} B = char(A) To extra...

How to convert a 1x1 cell to a string?

To convert a cell array of character vectors to a character array, use the “char” function. A = {'line'} B = char(A) To extra...

4 months ago | 15

| accepted

Answered

how to set graph size

Set the ‘Position’ property on the current figure (gcf). By default, the position is in pixels. x0=10; y0=10; width=550; hei...

how to set graph size

Set the ‘Position’ property on the current figure (gcf). By default, the position is in pixels. x0=10; y0=10; width=550; hei...

4 months ago | 23

| accepted

Answered

eliminate the nullspace of a matrix

If you have any matrix, square or not, you have only one possibility: remove entire rows or columns that are equal to zero E...

eliminate the nullspace of a matrix

If you have any matrix, square or not, you have only one possibility: remove entire rows or columns that are equal to zero E...

1 year ago | 0

| accepted

Answered

How do I transfer timeseries data to excel?

use xlswrite function

How do I transfer timeseries data to excel?

use xlswrite function

1 year ago | 0

| accepted

Answered

Deleting a Cell and shifting cells left

a = {'1' '2' '3' '4' '5' '6' '7' '8' '9'} a(3)=[]

Deleting a Cell and shifting cells left

a = {'1' '2' '3' '4' '5' '6' '7' '8' '9'} a(3)=[]

1 year ago | 0

| accepted

Answered

Copy a 3D input image to a cell array?

Im=imread('your_image') out{1}=Im

Copy a 3D input image to a cell array?

Im=imread('your_image') out{1}=Im

2 years ago | 0

| accepted

Answered

Power of abs. function

use <https://www.mathworks.com/help/simulink/slref/mathfunction.html Math function block> and set the pow function

Power of abs. function

use <https://www.mathworks.com/help/simulink/slref/mathfunction.html Math function block> and set the pow function

2 years ago | 1

Answered

Add text column to data

A=[1 1 4 1 2 1 1 3 1] B=repmat({'coordinate'},size(A,1),1) out=[B num2cell(A)]

Add text column to data

A=[1 1 4 1 2 1 1 3 1] B=repmat({'coordinate'},size(A,1),1) out=[B num2cell(A)]

2 years ago | 0

Answered

How to find max value and reduce it from other arrays

A = [ 1 3 50 60 1 1 40 60 1 4 30 60 2 3 40 50 2 4 30 50 2 1 50 50 2 9 10 50 3 2 20 0 3 9 30 0 3 5 40 0 4 2 50 -20 ...

How to find max value and reduce it from other arrays

A = [ 1 3 50 60 1 1 40 60 1 4 30 60 2 3 40 50 2 4 30 50 2 1 50 50 2 9 10 50 3 2 20 0 3 9 30 0 3 5 40 0 4 2 50 -20 ...

2 years ago | 0

| accepted

Answered

all possible combinations of three vectors

A=[1,5,6,9,12] B= [1,2,3,4,5,6] C= [3,18,27,69,72] [ii,jj,kk]=meshgrid(A,B,C); ii=permute(ii,[1 3 2]); jj=permute(jj,[2 1...

all possible combinations of three vectors

A=[1,5,6,9,12] B= [1,2,3,4,5,6] C= [3,18,27,69,72] [ii,jj,kk]=meshgrid(A,B,C); ii=permute(ii,[1 3 2]); jj=permute(jj,[2 1...

2 years ago | 0

Answered

How can I find elements in sequence in an array?

v=[2,3,6,8,9,10,12,14,16,17] id=[10 diff(v) 10]==1 ii1=strfind(id,[0 1]) ii2=strfind(id,[ 1 0])

How can I find elements in sequence in an array?

v=[2,3,6,8,9,10,12,14,16,17] id=[10 diff(v) 10]==1 ii1=strfind(id,[0 1]) ii2=strfind(id,[ 1 0])

2 years ago | 1

| accepted

Answered

If each element of vector with size (1,3) takes one value of 4 discrete values. How can I obtain all possible combinations of this vector?

If the order is not important v=[0 0.625 1.25 2.5] id=nchoosek(1:4,3) out=v(id)

If each element of vector with size (1,3) takes one value of 4 discrete values. How can I obtain all possible combinations of this vector?

If the order is not important v=[0 0.625 1.25 2.5] id=nchoosek(1:4,3) out=v(id)

2 years ago | 0

Answered

How to find string structure elements?

people(1).Surname='Judit'; people(1).Family_Name='White'; people(2).Surname='Margaret'; people(2).Family_Name='Brown'; peo...

How to find string structure elements?

people(1).Surname='Judit'; people(1).Family_Name='White'; people(2).Surname='Margaret'; people(2).Family_Name='Brown'; peo...

2 years ago | 0

| accepted

Answered

generate y(n)=y(n-1)+x(n)

n=10 y0=0; % Initial conditions y(1)=y0+x(1); for k=2:n y(k)=y(k-1)+x(k) end

generate y(n)=y(n-1)+x(n)

n=10 y0=0; % Initial conditions y(1)=y0+x(1); for k=2:n y(k)=y(k-1)+x(k) end

2 years ago | 0

| accepted

Answered

find same elements between two sequences

a=[2 5 4 6 6 7 9 8 4 5 61 2 56 41] b=[1 9 7 3 2 4 5 1 6 4 78 1 12 56 14 27 46 1 3 2 4] c=intersect(a,b)

find same elements between two sequences

a=[2 5 4 6 6 7 9 8 4 5 61 2 56 41] b=[1 9 7 3 2 4 5 1 6 4 78 1 12 56 14 27 46 1 3 2 4] c=intersect(a,b)

2 years ago | 0

Answered

how to convert cell to array

If v is your cell array out=cell2mat(v([1 3 4 5 7 ]))

how to convert cell to array

If v is your cell array out=cell2mat(v([1 3 4 5 7 ]))

2 years ago | 1

| accepted

Answered

Sum of nonzero vector elements

v= [1 2 3 0 0 0 4 5 0 6 7 0 8 9] ii=[0 v~=0 0] idx1=strfind(ii,[0 1]) idx2=strfind(ii,[1 0])-1 out=cell2mat(arrayfun(@(x,y...

Sum of nonzero vector elements

v= [1 2 3 0 0 0 4 5 0 6 7 0 8 9] ii=[0 v~=0 0] idx1=strfind(ii,[0 1]) idx2=strfind(ii,[1 0])-1 out=cell2mat(arrayfun(@(x,y...

2 years ago | 1

| accepted

Answered

Selecting unique pairs from a vector

imax = [1;2;3;4;5;6] out=nchoosek(imax,2)

Selecting unique pairs from a vector

imax = [1;2;3;4;5;6] out=nchoosek(imax,2)

2 years ago | 0

| accepted

Answered

How do I compare the elements of two vectors 1 by 1?

Use curly brackets uset1{i} == uset2{i} You can avoid for loop out=find(cellfun(@(x,y) x==y,uset1,uset2))

How do I compare the elements of two vectors 1 by 1?

Use curly brackets uset1{i} == uset2{i} You can avoid for loop out=find(cellfun(@(x,y) x==y,uset1,uset2))

2 years ago | 1

Answered

Seperate numbers in string to different array

str={'take off time 0.102 sec';'sensor1 initiated .361 sec, -31 (mv)';'sync at 50 ms'} out=regexp(str,'\s[-\d\.]?\.?\d+','mat...

Seperate numbers in string to different array

str={'take off time 0.102 sec';'sensor1 initiated .361 sec, -31 (mv)';'sync at 50 ms'} out=regexp(str,'\s[-\d\.]?\.?\d+','mat...

2 years ago | 0

Answered

how to find the closest values with tolerance in a matrix given a specific value

A=1000*rand(601,2201) ; % Example tol=0.02 th=185.2 [ii,jj]=find(abs(A-th)<tol) size(ii)

how to find the closest values with tolerance in a matrix given a specific value

A=1000*rand(601,2201) ; % Example tol=0.02 th=185.2 [ii,jj]=find(abs(A-th)<tol) size(ii)

2 years ago | 1

| accepted

Answered

Delete line of file based on number in first column

fid=fopen('file.txt'); l1=strtrim(fgetl(fid)); out={}; while ischar(l1) l2=strtrim(l1); if l2(1)~='8' ou...

Delete line of file based on number in first column

fid=fopen('file.txt'); l1=strtrim(fgetl(fid)); out={}; while ischar(l1) l2=strtrim(l1); if l2(1)~='8' ou...

2 years ago | 0

| accepted

Answered

Moving the contents in the cell array

data = {'abc' , 'def' , 'ghi'} data1([4 5 6])=data

Moving the contents in the cell array

data = {'abc' , 'def' , 'ghi'} data1([4 5 6])=data

2 years ago | 0

Answered

Duplicate elements in array n times, where n is an array itself

A = [1 2 3] B = [2 3 1] C=cell2mat(arrayfun(@(x,y) repmat(x,1,y),A,B,'un',0))

Duplicate elements in array n times, where n is an array itself

A = [1 2 3] B = [2 3 1] C=cell2mat(arrayfun(@(x,y) repmat(x,1,y),A,B,'un',0))

2 years ago | 0