
Akira Agata
MathWorks
統計
All
Content Feed
回答済み
同じ形式のファイルを読み込もうとするとエラーが出ます.
もしかすると 2 つのファイルの Delimiter の微妙な違いが影響している可能性があります (いずれも単純なタブ区切りではなく、半角スペースの連続で区切っているようです)。試したところ、readtable のオプションをより詳細に指定することで対応で...
同じ形式のファイルを読み込もうとするとエラーが出ます.
もしかすると 2 つのファイルの Delimiter の微妙な違いが影響している可能性があります (いずれも単純なタブ区切りではなく、半角スペースの連続で区切っているようです)。試したところ、readtable のオプションをより詳細に指定することで対応で...
11日 前 | 1
| 採用済み
回答済み
How to extract only the object and get the extreme coordinates?
How about the following? % Load the image I = imread('https://jp.mathworks.com/matlabcentral/answers/uploaded_files/1552757/20...
How to extract only the object and get the extreme coordinates?
How about the following? % Load the image I = imread('https://jp.mathworks.com/matlabcentral/answers/uploaded_files/1552757/20...
15日 前 | 1
| 採用済み
回答済み
テキストファイルにある値を区別したい
添付のテキストを拝見しましたが、標準的な構成ではないためやや工夫が必要です。 手っ取り早い方法としては インポートツール を使う方法があります。 別の方法としては、readtable でとりあえずデータ部分だけを読み込んで、整形や列名の設定はプログラム...
テキストファイルにある値を区別したい
添付のテキストを拝見しましたが、標準的な構成ではないためやや工夫が必要です。 手っ取り早い方法としては インポートツール を使う方法があります。 別の方法としては、readtable でとりあえずデータ部分だけを読み込んで、整形や列名の設定はプログラム...
19日 前 | 0
| 採用済み
回答済み
画像の輝度を0~256で表すコード
単純に「はい」か「いいえ」で答えられないご質問ですので、順を追って説明します。 まず、対象画像がすべて 8 bit 画像の場合、画像は uint8 型の数値配列として読み込まれます。これを rgb2gray で変換すると同じく uint8 型の配列となる...
画像の輝度を0~256で表すコード
単純に「はい」か「いいえ」で答えられないご質問ですので、順を追って説明します。 まず、対象画像がすべて 8 bit 画像の場合、画像は uint8 型の数値配列として読み込まれます。これを rgb2gray で変換すると同じく uint8 型の配列となる...
19日 前 | 1
回答済み
bodeコマンドで作成したボード線図のX軸のラベルの単位を任意のフォントにする方法
findall でX軸のラベルのグラフィックオブジェクトを抽出することで変更可能です。 たとえば日本語環境では、デフォルトのX軸ラベルは「周波数 (rad/s)」になっていると思います。そこで以下のようにするとラベルの文字列やフォントを変えることが可能...
bodeコマンドで作成したボード線図のX軸のラベルの単位を任意のフォントにする方法
findall でX軸のラベルのグラフィックオブジェクトを抽出することで変更可能です。 たとえば日本語環境では、デフォルトのX軸ラベルは「周波数 (rad/s)」になっていると思います。そこで以下のようにするとラベルの文字列やフォントを変えることが可能...
29日 前 | 2
| 採用済み
回答済み
重心動揺の外周面積の求め方
凸包とその面積を求めるのでしたら、convhull 関数が便利です。使い方は以下の例を参考にして下さい。 % (x, y) 座標データ (※簡単のため20点としています) x = randn(20, 1); y = 2*randn(20, 1); ...
重心動揺の外周面積の求め方
凸包とその面積を求めるのでしたら、convhull 関数が便利です。使い方は以下の例を参考にして下さい。 % (x, y) 座標データ (※簡単のため20点としています) x = randn(20, 1); y = 2*randn(20, 1); ...
29日 前 | 0
回答済み
陰関数の描画時において、(x,y)座標を変数にとりこみたい。
ImplicitFunctionLine の XData, YData プロパティは陰関数を描画した際に生成されます。 以下のようにすると、生成後の XData, YData を取得することができます。 % 陰関数を描画 figure h = fi...
陰関数の描画時において、(x,y)座標を変数にとりこみたい。
ImplicitFunctionLine の XData, YData プロパティは陰関数を描画した際に生成されます。 以下のようにすると、生成後の XData, YData を取得することができます。 % 陰関数を描画 figure h = fi...
約1ヶ月 前 | 0
| 採用済み
回答済み
Excelシート上のデータが読み込めない
MATLAB R2023bでは以下のように問題なく読み取ることができました。 お使いの MATLAB バージョンはどれになりますでしょうか? filePath = "https://jp.mathworks.com/matlabcentral/answ...
Excelシート上のデータが読み込めない
MATLAB R2023bでは以下のように問題なく読み取ることができました。 お使いの MATLAB バージョンはどれになりますでしょうか? filePath = "https://jp.mathworks.com/matlabcentral/answ...
約1ヶ月 前 | 0
回答済み
Crop a specific area for the sem image
How about the following? % Read the image I = imread("https://www.mathworks.com/matlabcentral/answers/uploaded_files/1522566/i...
Crop a specific area for the sem image
How about the following? % Read the image I = imread("https://www.mathworks.com/matlabcentral/answers/uploaded_files/1522566/i...
約2ヶ月 前 | 0
| 採用済み
回答済み
plot data points on a map
How about the following? data = readmatrix("https://jp.mathworks.com/matlabcentral/answers/uploaded_files/1515856/plot_map2.csv...
plot data points on a map
How about the following? data = readmatrix("https://jp.mathworks.com/matlabcentral/answers/uploaded_files/1515856/plot_map2.csv...
約2ヶ月 前 | 0
| 採用済み
回答済み
How do I change the type of colorbar for each tiled figure?
You can set colormap for each axes object, like: % sample data z = peaks(20); % display the data with different colormap t...
How do I change the type of colorbar for each tiled figure?
You can set colormap for each axes object, like: % sample data z = peaks(20); % display the data with different colormap t...
約2ヶ月 前 | 0
回答済み
Why can't I make a boxplot with data overlay?
How about using a boxchart ? The following is an example: % Sample data x = [ones(100,1); 2*ones(100,1); 4*ones(100,1)]; y =...
Why can't I make a boxplot with data overlay?
How about using a boxchart ? The following is an example: % Sample data x = [ones(100,1); 2*ones(100,1); 4*ones(100,1)]; y =...
約2ヶ月 前 | 1
| 採用済み
回答済み
for文の中で計算結果を変数に格納、ヒストグラムを描く
変数 s を配列として、for 文を回すごとに結果を保存してゆくのが良いかと思います。 たとえば 2 つのファイルの比較を100回実施する場合、以下のようなコードになるかと思います。 % 要素数100の配列を作成 s = zeros(100, 1);...
for文の中で計算結果を変数に格納、ヒストグラムを描く
変数 s を配列として、for 文を回すごとに結果を保存してゆくのが良いかと思います。 たとえば 2 つのファイルの比較を100回実施する場合、以下のようなコードになるかと思います。 % 要素数100の配列を作成 s = zeros(100, 1);...
約2ヶ月 前 | 1
回答済み
列の規則的な計算
@かおさま ご説明ありがとうございます。 処理内容を理解しました。以下のような処理ではいかがでしょうか。 ちなみに data, coordinate は、ExcelやCSVから readtable で読み込むことを想定してテーブル型変数としています。...
列の規則的な計算
@かおさま ご説明ありがとうございます。 処理内容を理解しました。以下のような処理ではいかがでしょうか。 ちなみに data, coordinate は、ExcelやCSVから readtable で読み込むことを想定してテーブル型変数としています。...
約2ヶ月 前 | 0
| 採用済み
回答済み
要素数が変わる変数を1つの配列にまとめて後から参照するには
以下のように、 cell 配列を使うと可能です。 % カラのcell配列を作成 posX = cell(3,1); % 要素数の異なる配列を順に入れる posX{1} = [10,20,30,40,50]; posX{2} = [3,90,2...
要素数が変わる変数を1つの配列にまとめて後から参照するには
以下のように、 cell 配列を使うと可能です。 % カラのcell配列を作成 posX = cell(3,1); % 要素数の異なる配列を順に入れる posX{1} = [10,20,30,40,50]; posX{2} = [3,90,2...
約2ヶ月 前 | 2
回答済み
乱数発生器の制御"rng"の影響範囲について
「一度コード内にrngを記述すると、その上の行にも影響を与えるのか?」とのご質問ですが、結論から言いますと「No」となります。rng(1) はその行以降の処理に影響を与えるのみで、それ以前の処理には影響しません。 おそらく、プログラムを何度も連続して実行...
乱数発生器の制御"rng"の影響範囲について
「一度コード内にrngを記述すると、その上の行にも影響を与えるのか?」とのご質問ですが、結論から言いますと「No」となります。rng(1) はその行以降の処理に影響を与えるのみで、それ以前の処理には影響しません。 おそらく、プログラムを何度も連続して実行...
5ヶ月 前 | 2
| 採用済み
回答済み
次元の違う配列の乗算について
配列 C を 3次元方向に繰り返して X1 とおなじサイズにすることで、ドット (.) による要素毎の乗算が可能です。 % サンプル配列 X1 = randi(100, [3, 3, 10]); C = [1 1 1; 2 2 2; 3 3 3]; ...
次元の違う配列の乗算について
配列 C を 3次元方向に繰り返して X1 とおなじサイズにすることで、ドット (.) による要素毎の乗算が可能です。 % サンプル配列 X1 = randi(100, [3, 3, 10]); C = [1 1 1; 2 2 2; 3 3 3]; ...
5ヶ月 前 | 1
回答済み
ボード線図の線を任意の色にする /How to make the lines of a bode diagram any color specified by RGB
bode 関数で生成されるボード線図は Line オブジェクトで構成されています。 このため、findobj 関数で Line オブジェクトを抽出してプロパティをセットすることで対応可能です。 具体的には以下のようになります。 % サンプルのボード線...
ボード線図の線を任意の色にする /How to make the lines of a bode diagram any color specified by RGB
bode 関数で生成されるボード線図は Line オブジェクトで構成されています。 このため、findobj 関数で Line オブジェクトを抽出してプロパティをセットすることで対応可能です。 具体的には以下のようになります。 % サンプルのボード線...
5ヶ月 前 | 0
| 採用済み
回答済み
ベクトル化を交えた組み合わせ計算の方法
ndgrid を使う方法はいかがでしょうか? たとえば簡単のため A~E をすべて 1:3 とすると、Z は以下のように計算できます。 % A~E すべての組み合わせに対して A*B*...*E を計算 [A, B, C, D, E] = ndgri...
ベクトル化を交えた組み合わせ計算の方法
ndgrid を使う方法はいかがでしょうか? たとえば簡単のため A~E をすべて 1:3 とすると、Z は以下のように計算できます。 % A~E すべての組み合わせに対して A*B*...*E を計算 [A, B, C, D, E] = ndgri...
5ヶ月 前 | 1
| 採用済み
回答済み
How to create new rows in a table based on nested cell arrays of different sizes
How about the following? load("file.mat"); bal = table(); for kk = 1:height(non_compliance_B) t = non_compliance_B(kk,...
How to create new rows in a table based on nested cell arrays of different sizes
How about the following? load("file.mat"); bal = table(); for kk = 1:height(non_compliance_B) t = non_compliance_B(kk,...
6ヶ月 前 | 0
回答済み
任意のxベクトルに対して、yベクトルの一次微分を計算することはできますか?
微分の定義 () より、dy を dx で割る必要があります。 たとえば今回の場合、x ベクトルの差分 dx は 0.05 のようですので、一次微分は以下のように求められます。 dx = 0.05; ydot = diff(y)/dx;
任意のxベクトルに対して、yベクトルの一次微分を計算することはできますか?
微分の定義 () より、dy を dx で割る必要があります。 たとえば今回の場合、x ベクトルの差分 dx は 0.05 のようですので、一次微分は以下のように求められます。 dx = 0.05; ydot = diff(y)/dx;
6ヶ月 前 | 1
回答済み
カラーの画像をグレースケールにすることなくラベリングしたい
Image Processing Toolbox の imsegkmeans 関数を使う方法もあります。 % 元画像を読み込み I = imread("https://www.mathworks.com/matlabcentral/answers/up...
カラーの画像をグレースケールにすることなくラベリングしたい
Image Processing Toolbox の imsegkmeans 関数を使う方法もあります。 % 元画像を読み込み I = imread("https://www.mathworks.com/matlabcentral/answers/up...
6ヶ月 前 | 1
回答済み
plot 2d image into cylindrical 3d image
How about the following? % Image data I = imread("sherlock.jpg"); % Create cylinder [X, Y, Z] = cylinder; % Mapping the...
plot 2d image into cylindrical 3d image
How about the following? % Image data I = imread("sherlock.jpg"); % Create cylinder [X, Y, Z] = cylinder; % Mapping the...
6ヶ月 前 | 2
回答済み
generate a matrix from given Bit combinations
How about the following solution? % Number of bits (-> please change this value) Nbit = 3; % Number of combination Ncmb = ...
generate a matrix from given Bit combinations
How about the following solution? % Number of bits (-> please change this value) Nbit = 3; % Number of combination Ncmb = ...
6ヶ月 前 | 0
| 採用済み
回答済み
stringとdoubleの配列を結合したいです
+1 もし ID が文字列でしたら、table 型変数として結合する方法もあります。 以下、簡単のためサイズが 3×1 の ID (string型) と 3×9 の LUT (double型) で説明します。 % ID, LUTのサンプル ID =...
stringとdoubleの配列を結合したいです
+1 もし ID が文字列でしたら、table 型変数として結合する方法もあります。 以下、簡単のためサイズが 3×1 の ID (string型) と 3×9 の LUT (double型) で説明します。 % ID, LUTのサンプル ID =...
7ヶ月 前 | 1
回答済み
using a matrix in a calculation
To do an element-wise calculation of an equation to a matrix, you should add dot (.) just before operator, like: vr = (v0*r)./(...
using a matrix in a calculation
To do an element-wise calculation of an equation to a matrix, you should add dot (.) just before operator, like: vr = (v0*r)./(...
7ヶ月 前 | 1
回答済み
Find only interior points from set of points
As an another possible solution, how about using boundary function to detect exterior points? The following is an example: % S...
Find only interior points from set of points
As an another possible solution, how about using boundary function to detect exterior points? The following is an example: % S...
8ヶ月 前 | 1
回答済み
pulse with modulation
If you have the Communications Toolbox, how about using commsrc.pattern ?
pulse with modulation
If you have the Communications Toolbox, how about using commsrc.pattern ?
8ヶ月 前 | 0
回答済み
音声データ(wavファイル)を5秒ごとに切り取る方法
以下のようにすれば実現可能かと思います。 % 対象の .wav ファイルを読み込み [y, fs] = audioread('fiveMinutesAudioFile.wav'); % 5秒分のサンプル数と全ファイル数を計算 (ただし最後に5秒以...
音声データ(wavファイル)を5秒ごとに切り取る方法
以下のようにすれば実現可能かと思います。 % 対象の .wav ファイルを読み込み [y, fs] = audioread('fiveMinutesAudioFile.wav'); % 5秒分のサンプル数と全ファイル数を計算 (ただし最後に5秒以...
8ヶ月 前 | 1
回答済み
Finding indices of certain numbers from simulation data
How about using ismembertol function? The following is an example: x = [1, 1/3, 3/4, 4/5, 1, 1.1]; idx = ismembertol(x, 0.33,...
Finding indices of certain numbers from simulation data
How about using ismembertol function? The following is an example: x = [1, 1/3, 3/4, 4/5, 1, 1.1]; idx = ismembertol(x, 0.33,...
9ヶ月 前 | 0