Answered

Detect the vertical dark layers in greysacale image

By applying findpeaks function (with appropriate option settings) to the average intensity profile, you can detect locations of ...

Detect the vertical dark layers in greysacale image

By applying findpeaks function (with appropriate option settings) to the average intensity profile, you can detect locations of ...

2 days ago | 1

Answered

Generate a diagonal matrix from the elements of another matrix

I would recommend using diag function. The following is an example: A = [1 2 3 4 5; 6 7 8 9 10]; A = A'; output = diag(...

Generate a diagonal matrix from the elements of another matrix

I would recommend using diag function. The following is an example: A = [1 2 3 4 5; 6 7 8 9 10]; A = A'; output = diag(...

2 days ago | 0

| accepted

Answered

How do you order the results of the combination?

Like this? % Create 1-by-14 cell array {'a','b', ..., 'n'} str = 'a':'n'; c = split(str,'')'; c([1 end]) = []; % Create a...

How do you order the results of the combination?

Like this? % Create 1-by-14 cell array {'a','b', ..., 'n'} str = 'a':'n'; c = split(str,'')'; c([1 end]) = []; % Create a...

2 days ago | 1

| accepted

Answered

Extract specific rows of a cell

OK. Then, to avoid misunderstanding, let's use a simple example. Say, A is a 1-by-3 cell array and r = 4, as follows: A = {ran...

Extract specific rows of a cell

OK. Then, to avoid misunderstanding, let's use a simple example. Say, A is a 1-by-3 cell array and r = 4, as follows: A = {ran...

2 days ago | 0

Answered

How to draw grid lines at specific x- and y-ticks?

How about using xline and yline functions? The following is an example: % Sample plot figure scatter(-1+2*rand(100,1),-1+2*r...

How to draw grid lines at specific x- and y-ticks?

How about using xline and yline functions? The following is an example: % Sample plot figure scatter(-1+2*rand(100,1),-1+2*r...

2 days ago | 0

Answered

How display a log space bar figure ?

Please set YScale property of the axes to 'log'. The following is an example. maxV_l = [0.015232 0.020273 0.0069196 0.012027...

How display a log space bar figure ?

Please set YScale property of the axes to 'log'. The following is an example. maxV_l = [0.015232 0.020273 0.0069196 0.012027...

2 days ago | 1

Answered

不規則な位置座標に値を格納，プロット

単純に、それぞれのデータ点をnの値に応じた色で表示するには、以下のようにすれば可能です。データ点が十分にあるようであれば、scatteredInterpolant関数で内挿して、等値面などの形で表示するという方法もあります。 figure scatte...

不規則な位置座標に値を格納，プロット

単純に、それぞれのデータ点をnの値に応じた色で表示するには、以下のようにすれば可能です。データ点が十分にあるようであれば、scatteredInterpolant関数で内挿して、等値面などの形で表示するという方法もあります。 figure scatte...

2 days ago | 0

Answered

How to create filename with variable within loop

How about the following? T = readtable('Stations coordinates.txt'); fileName = append('Hourly Data ',T.Station,' 2015.txt'); ...

How to create filename with variable within loop

How about the following? T = readtable('Stations coordinates.txt'); fileName = append('Hourly Data ',T.Station,' 2015.txt'); ...

4 days ago | 1

| accepted

Answered

How to replace elements in a integer vector with chars using a lookup table

How about the following way? % Sample data A = randi([0 6],10,1); B = table(compose('Str %d',1:7)',(0:6)',... 'VariableNam...

How to replace elements in a integer vector with chars using a lookup table

How about the following way? % Sample data A = randi([0 6],10,1); B = table(compose('Str %d',1:7)',(0:6)',... 'VariableNam...

4 days ago | 0

| accepted

Answered

Interpolate 1 array to another

If you don't have the Image Processing Toolbox, interp2 would be your friend, like: % assuming array1 is a 5x9000 numeric array...

Interpolate 1 array to another

If you don't have the Image Processing Toolbox, interp2 would be your friend, like: % assuming array1 is a 5x9000 numeric array...

8 days ago | 0

Answered

How to replace the empty cells in a cell array by a 4-bits string?

How about the following? load('Key.mat'); idx = cellfun(@isempty,Key); % Find the indexes of empty cell Key(idx) = {'0000'}; ...

How to replace the empty cells in a cell array by a 4-bits string?

How about the following? load('Key.mat'); idx = cellfun(@isempty,Key); % Find the indexes of empty cell Key(idx) = {'0000'}; ...

8 days ago | 1

| accepted

Answered

merge values of a vector

Like this? x = 1:4; % sample input array s = num2str(x,'%d'); y = str2double(s); >> y y = 1234

merge values of a vector

Like this? x = 1:4; % sample input array s = num2str(x,'%d'); y = str2double(s); >> y y = 1234

8 days ago | 1

| accepted

Answered

writing in a pre-existing txt file ?

Assuming the pre-existing text file is data.txt, how about the following? cInput = readcell('data.txt','Delimiter','\n'); cA...

writing in a pre-existing txt file ?

Assuming the pre-existing text file is data.txt, how about the following? cInput = readcell('data.txt','Delimiter','\n'); cA...

12 days ago | 0

Answered

How can I extract the harmonic related numbers from a matrix?

How about the following? x = [90 100 110 200 220 250 300 330 340 400 420 500]; tfUsed = false(size(x)); R = x./x'; idx = R...

How can I extract the harmonic related numbers from a matrix?

How about the following? x = [90 100 110 200 220 250 300 330 340 400 420 500]; tfUsed = false(size(x)); R = x./x'; idx = R...

12 days ago | 0

| accepted

Answered

Machine Learning Signal Processing Help

I believe one good starting point would be descriptive statistics listed in this page (Signal Processing Toolbox), or Diagnostic...

Machine Learning Signal Processing Help

I believe one good starting point would be descriptive statistics listed in this page (Signal Processing Toolbox), or Diagnostic...

13 days ago | 0

Answered

splitting dataset into training set and testing set

You can split your dataset by using partition function, like: [setTrain, setTest] = partition(faceDatabase, [0.8, 0.2], 'random...

splitting dataset into training set and testing set

You can split your dataset by using partition function, like: [setTrain, setTest] = partition(faceDatabase, [0.8, 0.2], 'random...

13 days ago | 0

| accepted

Answered

how to create multiple matrix from a single matrix

If you have Image Processing Toolbox, how about the following? % Sample data A = [... 1 2 3;... 4 5 6;... 7 8 9;... ...

how to create multiple matrix from a single matrix

If you have Image Processing Toolbox, how about the following? % Sample data A = [... 1 2 3;... 4 5 6;... 7 8 9;... ...

21 days ago | 0

| accepted

Answered

change color of outlier limit in box plots

How about the following solution? % Sample data x = randn(1000,4); % Create boxplot without outlier markers figure boxplo...

change color of outlier limit in box plots

How about the following solution? % Sample data x = randn(1000,4); % Create boxplot without outlier markers figure boxplo...

23 days ago | 0

| accepted

Answered

how do I add msec to datetime?

Please set the display format to show millisecond, like: >> Ts.Format = 'uuuu/MM/dd HH:mm:ss.SSS'; >> Ts Ts = datetime ...

how do I add msec to datetime?

Please set the display format to show millisecond, like: >> Ts.Format = 'uuuu/MM/dd HH:mm:ss.SSS'; >> Ts Ts = datetime ...

29 days ago | 0

| accepted

Answered

How to replace elements of matrix by elemts from array

Basically, this task can be done by: NewV = reshape(x,8,[])'; But in your case, length(x) can NOT be devided by k (=8). So you...

How to replace elements of matrix by elemts from array

Basically, this task can be done by: NewV = reshape(x,8,[])'; But in your case, length(x) can NOT be devided by k (=8). So you...

1 month ago | 0

Answered

ファブリペロー干渉計について

初期パラメータを以下のように想定して計算したところ、波長によっては透過率（＝出力光電力／入力光電力）が 1 を超えるという結果になっています。記載頂いた式のどこかに誤りがあると思われますので、再度ご確認頂けないでしょうか。 % 設定パラメータ Rx =...

ファブリペロー干渉計について

初期パラメータを以下のように想定して計算したところ、波長によっては透過率（＝出力光電力／入力光電力）が 1 を超えるという結果になっています。記載頂いた式のどこかに誤りがあると思われますので、再度ご確認頂けないでしょうか。 % 設定パラメータ Rx =...

1 month ago | 3

| accepted

Answered

Overlay curves over heatmap

How about the following way? Plot the heatmap Add axes over the heatmap Plot lines on the axes Set the background color of t...

Overlay curves over heatmap

How about the following way? Plot the heatmap Add axes over the heatmap Plot lines on the axes Set the background color of t...

1 month ago | 1

| accepted

Answered

Simplifying an array with repeat values in it

How about the following? load('data.mat'); [g,tbl] = findgroups(data(:,{'partnumber','description'})); QYT = splitapply(@sum,...

Simplifying an array with repeat values in it

How about the following? load('data.mat'); [g,tbl] = findgroups(data(:,{'partnumber','description'})); QYT = splitapply(@sum,...

1 month ago | 0

Answered

Error in the medical image display

How about the following? imshow(T_1,[]); In addition, I believe the line 'T_1 = squeeze(C);' can be deleted.

Error in the medical image display

How about the following? imshow(T_1,[]); In addition, I believe the line 'T_1 = squeeze(C);' can be deleted.

1 month ago | 0

| accepted

Answered

plotting date from datetime array

'Y' should be a captal letter. Please try: histogram(d.Year)

plotting date from datetime array

'Y' should be a captal letter. Please try: histogram(d.Year)

1 month ago | 0

| accepted

Answered

to determine rainfall data

I would recommend using timetable and retime functions, rather than using for-loop. The following is an example: % Read data ...

to determine rainfall data

I would recommend using timetable and retime functions, rather than using for-loop. The following is an example: % Read data ...

2 months ago | 0

Answered

Cycle counting from 0

How about the following? x = [0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 1 1 1 0 0 0 0 1 1 1 1 1 0 0 0 0 0]; str = num2str(...

Cycle counting from 0

How about the following? x = [0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 1 1 1 0 0 0 0 1 1 1 1 1 0 0 0 0 0]; str = num2str(...

2 months ago | 0

Answered

How to fit an ellipse to an image in matlab.

How about the following? % Read image I = imread('diskimage1.jpeg'); % Binarize Igray = rgb2gray(I); BW = imbinarize(Igra...

How to fit an ellipse to an image in matlab.

How about the following? % Read image I = imread('diskimage1.jpeg'); % Binarize Igray = rgb2gray(I); BW = imbinarize(Igra...

2 months ago | 0

| accepted

Answered

Changing gregorian date number to calendar date and time

If your time vector represents hours since 1900-01-01 00:00:00.0 , following code can convert it into yyyy-MM-dd. T = datetime...

Changing gregorian date number to calendar date and time

If your time vector represents hours since 1900-01-01 00:00:00.0 , following code can convert it into yyyy-MM-dd. T = datetime...

2 months ago | 1

| accepted

Answered

特定の文字を抽出してプログラムを制御する方法と、テーブルに複数の単語を格納する方法についてご教授お願いいたします。

前回に引き続き、ちょっと面白そうなので少し考えてみました。 ざっと以下のようなプログラムになるかと思います。 ご質問の２点については、コメント欄に「★」をつけた部分になります。参考になれば幸いです。 % テーブルd(ictionary)の作成 T_...

特定の文字を抽出してプログラムを制御する方法と、テーブルに複数の単語を格納する方法についてご教授お願いいたします。

前回に引き続き、ちょっと面白そうなので少し考えてみました。 ざっと以下のようなプログラムになるかと思います。 ご質問の２点については、コメント欄に「★」をつけた部分になります。参考になれば幸いです。 % テーブルd(ictionary)の作成 T_...

2 months ago | 1

| accepted