Answered

for文とif文の併用

やりたい内容は、「条件 Y(k) <= sr & Y(k+1) >= sr を満たす点での dY/dX の値を計算し、結果を配列 C として保存したい」と理解しました（間違っていたらご指摘ください）。 以下の方法ではいかがでしょうか。ただし上記条件を満た...

for文とif文の併用

やりたい内容は、「条件 Y(k) <= sr & Y(k+1) >= sr を満たす点での dY/dX の値を計算し、結果を配列 C として保存したい」と理解しました（間違っていたらご指摘ください）。 以下の方法ではいかがでしょうか。ただし上記条件を満た...

3 mois ago | 1

Answered

Determine separated node in graph

I'm not sure what is the final goal and/or application of this process. But let me try to do this task (since this "puzzle" will...

Determine separated node in graph

I'm not sure what is the final goal and/or application of this process. But let me try to do this task (since this "puzzle" will...

3 mois ago | 0

| accepted

Answered

how to create block circulant matrix?

How about the following? % For simple example n = 3; m = 2; % Create n-by-n circulant matrix B_block = gallery('circul',1...

how to create block circulant matrix?

How about the following? % For simple example n = 3; m = 2; % Create n-by-n circulant matrix B_block = gallery('circul',1...

3 mois ago | 0

| accepted

Answered

Creating a matrix which contains submatrices

Assuming the submatrix is n-by-n Identity matrix, the solution would be like this: n = input('Please enter n: '); subMat = eye...

Creating a matrix which contains submatrices

Assuming the submatrix is n-by-n Identity matrix, the solution would be like this: n = input('Please enter n: '); subMat = eye...

3 mois ago | 0

Answered

Merge two columns of same table into one

Assuming columns A and B are cell array of characters, how about the following? % Sample input table A = {'123';'234';'345'}; ...

Merge two columns of same table into one

Assuming columns A and B are cell array of characters, how about the following? % Sample input table A = {'123';'234';'345'}; ...

3 mois ago | 0

| accepted

Answered

plotを使用してグラフの色をデータに応じて変更する方法

以下のように、グラフオブジェクトを構築・可視化する方法はいかがでしょうか？ % データ点の(x,y)座標 x = [1,5,10,20]; y = [1,4,5,10]; % Edgeの始点(s),終点(t),重み(w) % ※注：組み合わせ...

plotを使用してグラフの色をデータに応じて変更する方法

以下のように、グラフオブジェクトを構築・可視化する方法はいかがでしょうか？ % データ点の(x,y)座標 x = [1,5,10,20]; y = [1,4,5,10]; % Edgeの始点(s),終点(t),重み(w) % ※注：組み合わせ...

3 mois ago | 1

| accepted

Answered

How to filter tables in the cell?

How about the following? C_Winter = cellfun(@(x) x(strcmp(x.season,'Winter'),:),C,'UniformOutput',false); The same solution wi...

How to filter tables in the cell?

How about the following? C_Winter = cellfun(@(x) x(strcmp(x.season,'Winter'),:),C,'UniformOutput',false); The same solution wi...

3 mois ago | 1

| accepted

Answered

How to plot binary sine function?

How about modulating a phase with 0 <-> pi ? The following is an example: T = 3; time = linspace(0,T*4,1000); % Create a p...

How to plot binary sine function?

How about modulating a phase with 0 <-> pi ? The following is an example: T = 3; time = linspace(0,T*4,1000); % Create a p...

3 mois ago | 0

| accepted

Answered

Box plotのボックス内の色を変更する方法

R2020aでMATLABの基本関数に追加されたboxchartを使うのはいかがでしょうか？ たとえば以下のようにすると、Box内と外れ値のマーカー色をグレーに指定することができます。 figure boxchart(x,'BoxFaceColor'...

Box plotのボックス内の色を変更する方法

R2020aでMATLABの基本関数に追加されたboxchartを使うのはいかがでしょうか？ たとえば以下のようにすると、Box内と外れ値のマーカー色をグレーに指定することができます。 figure boxchart(x,'BoxFaceColor'...

3 mois ago | 1

Answered

make one part of a function repeat it self in diffrent sections of time line.

If you have a Signal Processing Toolbox, you can simply use sawtooth function, like: % Generate signal t = linspace(-4*pi,4*pi...

make one part of a function repeat it self in diffrent sections of time line.

If you have a Signal Processing Toolbox, you can simply use sawtooth function, like: % Generate signal t = linspace(-4*pi,4*pi...

3 mois ago | 0

Answered

How to Measuring Peak Widths

I believe findpeaks function can do that task. The following is an example: % Load sample data load sunsplot.dat; % Define ...

How to Measuring Peak Widths

I believe findpeaks function can do that task. The following is an example: % Load sample data load sunsplot.dat; % Define ...

3 mois ago | 0

| accepted

Answered

How to plot contur in 3 D

OK. Then, how about the following? % Read all the data in the Excel file T = table(); for kk = 1:8 Ttmp = readtable('Conto...

How to plot contur in 3 D

OK. Then, how about the following? % Read all the data in the Excel file T = table(); for kk = 1:8 Ttmp = readtable('Conto...

3 mois ago | 0

Answered

Comparing numerical values of a 5x2 cell

I would recommend storing your data as a table variable before processing, like: % Data ca = { 'Red Car', 50; 'Blue Car', 45...

Comparing numerical values of a 5x2 cell

I would recommend storing your data as a table variable before processing, like: % Data ca = { 'Red Car', 50; 'Blue Car', 45...

3 mois ago | 0

Answered

extracting index number if an item exist in some columns while not in the rest columns

OK. Then, the solution would be like this: % Sample table Name = {'David','Bowie','Lynch','Mirewuti','Muhetaer','Akira','Agata...

extracting index number if an item exist in some columns while not in the rest columns

OK. Then, the solution would be like this: % Sample table Name = {'David','Bowie','Lynch','Mirewuti','Muhetaer','Akira','Agata...

4 mois ago | 1

| accepted

Answered

How do I find the column of maximum values of a maxtrix?

If you want to find the column where the maximum value in 2D matrix locates, one simple way is: [~,col] = max(max(x)); For exa...

How do I find the column of maximum values of a maxtrix?

If you want to find the column where the maximum value in 2D matrix locates, one simple way is: [~,col] = max(max(x)); For exa...

4 mois ago | 0

| accepted

Answered

defining a polygon area within an array

How about the following solution? % 100-by-100 sample matrix Zin = peaks(100); Zin = Zin - min(Zin(:)); % Example of polyg...

defining a polygon area within an array

How about the following solution? % 100-by-100 sample matrix Zin = peaks(100); Zin = Zin - min(Zin(:)); % Example of polyg...

4 mois ago | 1

Answered

hwo can i do this image that shades from white at the image edges to black in the image centre

I believe you can do this more efficiently. The following is an example: % Set image size imSize = 100; % Make a left-top p...

hwo can i do this image that shades from white at the image edges to black in the image centre

I believe you can do this more efficiently. The following is an example: % Set image size imSize = 100; % Make a left-top p...

4 mois ago | 1

Answered

How to extract specific rows & columns from a text file

Thank you for uploading an example. How about the following? % Read from text data T = readtable('Example.txt','HeaderLines',4...

How to extract specific rows & columns from a text file

Thank you for uploading an example. How about the following? % Read from text data T = readtable('Example.txt','HeaderLines',4...

4 mois ago | 1

Answered

Generate 0 and 1

Just FYI: To evaluate BER (Bit Error Rate) of digital communication system, PRBS (Pseudo Random Binary Sequence) has been commo...

Generate 0 and 1

Just FYI: To evaluate BER (Bit Error Rate) of digital communication system, PRBS (Pseudo Random Binary Sequence) has been commo...

4 mois ago | 0

Answered

Iterating over values in multiple arrays

How about the following? C = B'-A; C = C(:);

Iterating over values in multiple arrays

How about the following? C = B'-A; C = C(:);

4 mois ago | 0

Answered

Plotting voronoi tesselations without its seeds

How about the following? % Seeds x = gallery('uniformdata',[1 10],0); y = gallery('uniformdata',[1 10],1); % Calculate Vo...

Plotting voronoi tesselations without its seeds

How about the following? % Seeds x = gallery('uniformdata',[1 10],0); y = gallery('uniformdata',[1 10],1); % Calculate Vo...

4 mois ago | 0

Answered

Finding rows that have only two unique clusters of values with a spread of +/- 1

How about using uniquetol function? The following is an example: % Sample matrix (a = 5, b = 10, c = 15 in your matrix) Z = [...

Finding rows that have only two unique clusters of values with a spread of +/- 1

How about using uniquetol function? The following is an example: % Sample matrix (a = 5, b = 10, c = 15 in your matrix) Z = [...

4 mois ago | 0

Answered

Animated Quiver Vector Plot

How about using a graphic handle? Here is an example: [x,y] = meshgrid(0:0.2:2,0:0.2:2); u = cos(x).*y; v = sin(x).*y; fi...

Animated Quiver Vector Plot

How about using a graphic handle? Here is an example: [x,y] = meshgrid(0:0.2:2,0:0.2:2); u = cos(x).*y; v = sin(x).*y; fi...

4 mois ago | 1

| accepted

Answered

Nested loops for double summation

How about the following? % Example of 3-by-3 array n n = rand(3); % Calculate R, C, and T R = sum(n,2); C = sum(n); T = ...

Nested loops for double summation

How about the following? % Example of 3-by-3 array n n = rand(3); % Calculate R, C, and T R = sum(n,2); C = sum(n); T = ...

4 mois ago | 1

Answered

How can I use a for loop to index a vector, average the indexed values, and store the averages in another vector when the subsets are of different lengths?

You don't need to use for-loop. How about the following? load('fluxhour.mat'); [group,hourNum] = findgroups(Hour); avgFlux...

How can I use a for loop to index a vector, average the indexed values, and store the averages in another vector when the subsets are of different lengths?

You don't need to use for-loop. How about the following? load('fluxhour.mat'); [group,hourNum] = findgroups(Hour); avgFlux...

4 mois ago | 1

| accepted

Answered

Create vector of cell arrays of ranges from 0 to the value in each index of another vector

Like this? % Example of original cell oriCell = {6;9;3;8;2}; % Generated cell array outCell = cellfun(@(x) 0:x,oriCell,'Un...

Create vector of cell arrays of ranges from 0 to the value in each index of another vector

Like this? % Example of original cell oriCell = {6;9;3;8;2}; % Generated cell array outCell = cellfun(@(x) 0:x,oriCell,'Un...

4 mois ago | 0

| accepted

Answered

How to flatten and split and concatenate arrays in several files

I think the following code can do that task: By the way, your code will output 28440-by-1 (28440 = 9480 x 3), not the 3-by-9480...

How to flatten and split and concatenate arrays in several files

I think the following code can do that task: By the way, your code will output 28440-by-1 (28440 = 9480 x 3), not the 3-by-9480...

4 mois ago | 0

| accepted

Answered

Trying to extract different numbers out of structured text

I believe 'Regular Expression' will extract the target part of string. The following is an example. % Extract target part of s...

Trying to extract different numbers out of structured text

I believe 'Regular Expression' will extract the target part of string. The following is an example. % Extract target part of s...

4 mois ago | 1

| accepted

Answered

produce all combinations of n choose k in binary

Another solution: n = 5; k = 3; A = unique(perms([zeros(1,n-k) ones(1,k)]),'rows');

produce all combinations of n choose k in binary

Another solution: n = 5; k = 3; A = unique(perms([zeros(1,n-k) ones(1,k)]),'rows');

4 mois ago | 0

Answered

メンバ変数に行列を持つ構造体の配列について, その行列の特定の要素を配列で平均したい

以下の方法ではいかがでしょうか？ % 構造体配列からフィールド b の (1,1) 要素だけを抽出 c = arrayfun(@(x) x.b(1,1), a); % 平均値を計算 c_av = mean(c);

メンバ変数に行列を持つ構造体の配列について, その行列の特定の要素を配列で平均したい

以下の方法ではいかがでしょうか？ % 構造体配列からフィールド b の (1,1) 要素だけを抽出 c = arrayfun(@(x) x.b(1,1), a); % 平均値を計算 c_av = mean(c);

4 mois ago | 0

| accepted