Community Profile

photo

Akira Agata

MathWorks

Last seen: Today Active since 2016

Statistics

All
  • 5-Star Galaxy Level 4
  • GitHub Submissions Level 1
  • 36 Month Streak
  • Personal Best Downloads Level 2
  • Editor's Pick
  • First Review
  • First Submission
  • Guiding Light
  • Knowledgeable Level 5
  • Solver
  • Revival Level 2
  • First Answer

View badges

Content Feed

Answered
How to erase black letters in an image
How about the following? I = imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1611496/image.jpeg'); Igra...

1 month ago | 1

Answered
関数の計算について
J = meanLuminance + 15*sin((numfiles*pi)/776) の部分が原因です。 numfiles = 776 なので、上記の右辺第2項は 15*sin(pi) = 0 となるため、最終的には J = meanLumina...

1 month ago | 1

Answered
同じ形式のファイルを読み込もうとするとエラーが出ます.
もしかすると 2 つのファイルの Delimiter の微妙な違いが影響している可能性があります (いずれも単純なタブ区切りではなく、半角スペースの連続で区切っているようです)。試したところ、readtable のオプションをより詳細に指定することで対応で...

4 months ago | 1

| accepted

Answered
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...

4 months ago | 1

| accepted

Answered
テキストファイルにある値を区別したい
添付のテキストを拝見しましたが、標準的な構成ではないためやや工夫が必要です。 手っ取り早い方法としては インポートツール を使う方法があります。 別の方法としては、readtable でとりあえずデータ部分だけを読み込んで、整形や列名の設定はプログラム...

4 months ago | 0

| accepted

Answered
画像の輝度を0~256で表すコード
単純に「はい」か「いいえ」で答えられないご質問ですので、順を追って説明します。 まず、対象画像がすべて 8 bit 画像の場合、画像は uint8 型の数値配列として読み込まれます。これを rgb2gray で変換すると同じく uint8 型の配列となる...

4 months ago | 1

| accepted

Answered
bodeコマンドで作成したボード線図のX軸のラベルの単位を任意のフォントにする方法
findall でX軸のラベルのグラフィックオブジェクトを抽出することで変更可能です。 たとえば日本語環境では、デフォルトのX軸ラベルは「周波数 (rad/s)」になっていると思います。そこで以下のようにするとラベルの文字列やフォントを変えることが可能...

4 months ago | 2

| accepted

Answered
重心動揺の外周面積の求め方
凸包とその面積を求めるのでしたら、convhull 関数が便利です。使い方は以下の例を参考にして下さい。 % (x, y) 座標データ (※簡単のため20点としています) x = randn(20, 1); y = 2*randn(20, 1); ...

4 months ago | 0

| accepted

Answered
陰関数の描画時において、(x,y)座標を変数にとりこみたい。
ImplicitFunctionLine の XData, YData プロパティは陰関数を描画した際に生成されます。 以下のようにすると、生成後の XData, YData を取得することができます。 % 陰関数を描画 figure h = fi...

4 months ago | 0

| accepted

Answered
Excelシート上のデータが読み込めない
MATLAB R2023bでは以下のように問題なく読み取ることができました。 お使いの MATLAB バージョンはどれになりますでしょうか? filePath = "https://jp.mathworks.com/matlabcentral/answ...

5 months ago | 0

Answered
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...

5 months ago | 0

| accepted

Answered
plot data points on a map
How about the following? data = readmatrix("https://jp.mathworks.com/matlabcentral/answers/uploaded_files/1515856/plot_map2.csv...

5 months ago | 0

| accepted

Answered
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...

5 months ago | 0

Answered
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 =...

5 months ago | 1

| accepted

Answered
for文の中で計算結果を変数に格納、ヒストグラムを描く
変数 s を配列として、for 文を回すごとに結果を保存してゆくのが良いかと思います。 たとえば 2 つのファイルの比較を100回実施する場合、以下のようなコードになるかと思います。 % 要素数100の配列を作成 s = zeros(100, 1);...

5 months ago | 1

Answered
列の規則的な計算
@かおさま ご説明ありがとうございます。 処理内容を理解しました。以下のような処理ではいかがでしょうか。 ちなみに data, coordinate は、ExcelやCSVから readtable で読み込むことを想定してテーブル型変数としています。...

5 months ago | 0

| accepted

Answered
要素数が変わる変数を1つの配列にまとめて後から参照するには
以下のように、 cell 配列を使うと可能です。 % カラのcell配列を作成 posX = cell(3,1); % 要素数の異なる配列を順に入れる posX{1} = [10,20,30,40,50]; posX{2} = [3,90,2...

5 months ago | 2

Answered
乱数発生器の制御"rng"の影響範囲について
「一度コード内にrngを記述すると、その上の行にも影響を与えるのか?」とのご質問ですが、結論から言いますと「No」となります。rng(1) はその行以降の処理に影響を与えるのみで、それ以前の処理には影響しません。 おそらく、プログラムを何度も連続して実行...

8 months ago | 2

| accepted

Answered
次元の違う配列の乗算について
配列 C を 3次元方向に繰り返して X1 とおなじサイズにすることで、ドット (.) による要素毎の乗算が可能です。 % サンプル配列 X1 = randi(100, [3, 3, 10]); C = [1 1 1; 2 2 2; 3 3 3]; ...

9 months ago | 1

Answered
ボード線図の線を任意の色にする /How to make the lines of a bode diagram any color specified by RGB
bode 関数で生成されるボード線図は Line オブジェクトで構成されています。 このため、findobj 関数で Line オブジェクトを抽出してプロパティをセットすることで対応可能です。 具体的には以下のようになります。 % サンプルのボード線...

9 months ago | 0

| accepted

Answered
ベクトル化を交えた組み合わせ計算の方法
ndgrid を使う方法はいかがでしょうか? たとえば簡単のため A~E をすべて 1:3 とすると、Z は以下のように計算できます。 % A~E すべての組み合わせに対して A*B*...*E を計算 [A, B, C, D, E] = ndgri...

9 months ago | 1

| accepted

Answered
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,...

9 months ago | 0

Answered
任意のxベクトルに対して、yベクトルの一次微分を計算することはできますか?
微分の定義 () より、dy を dx で割る必要があります。 たとえば今回の場合、x ベクトルの差分 dx は 0.05 のようですので、一次微分は以下のように求められます。 dx = 0.05; ydot = diff(y)/dx;

9 months ago | 1

Answered
カラーの画像をグレースケールにすることなくラベリングしたい
Image Processing Toolbox の imsegkmeans 関数を使う方法もあります。 % 元画像を読み込み I = imread("https://www.mathworks.com/matlabcentral/answers/up...

9 months ago | 1

Answered
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...

10 months ago | 2

Answered
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 = ...

10 months ago | 0

| accepted

Answered
stringとdoubleの配列を結合したいです
+1 もし ID が文字列でしたら、table 型変数として結合する方法もあります。 以下、簡単のためサイズが 3×1 の ID (string型) と 3×9 の LUT (double型) で説明します。 % ID, LUTのサンプル ID =...

10 months ago | 1

Answered
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)./(...

11 months ago | 1

Answered
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...

11 months ago | 1

Answered
pulse with modulation
If you have the Communications Toolbox, how about using commsrc.pattern ?

11 months ago | 0

Load more