Answered
音声データ(wavファイル)を5秒ごとに切り取る方法
以下のようにすれば実現可能かと思います。 % 対象の .wav ファイルを読み込み [y, fs] = audioread('fiveMinutesAudioFile.wav'); % 5秒分のサンプル数と全ファイル数を計算 (ただし最後に5秒以...

12 months ago | 1

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

1 year ago | 0

Answered
画像の明るさ変更
最近追加された関数を使用しないということでしたら、MATLABによるコントラスト強調方法 のページが参考になるかと思います。

1 year ago | 0

| accepted

Answered
rename files in a folder
How about the following solution? % Create list of all files in the current folder s = dir(pwd); s = struct2table(s); % Ex...

1 year ago | 1

| accepted

Answered
Help on creating a new column and fill values at specific locations
How about the following? % Example v1 = 1:4; v2 = [3, 6, 8, 10]; v3 = 1:10; % Create the new vector newVec = zeros(size(...

1 year ago | 0

| accepted

Answered
how to remove the cracks on image?
How about using inpaintCoherent or inpaintExemplar function?

1 year ago | 0

Answered
Marker on contourf plot
Please use (x,y) coordinate for plotting markers. The following is an example: load('Test.mat'); % Find (x,y) coordinate of...

1 year ago | 1

Answered
Create logarithmically spaced vector with points spaced more closely at far end of vector
Like this? % Normal log-spaced vector x1 = logspace(1, 2, 10); % Create inverse log space delta = diff(x1); delta = flipl...

1 year ago | 1

| accepted

Answered
How can I change the Nan values in a matrix by the values in cells array?
If you want to replace NaN by the given value in linear index order, the following will be one possible solution: % Given matri...

1 year ago | 1

Answered
画像から1ピクセルの長さを求めたい
コメントありがとうございます。 方眼幅のピクセル数を自動的に算出したいとのことですが、以下の方法はいかがでしょうか? ちなみに、今回のケースは方眼が白色の線ですので平均輝度値のピークを検出していますが、黒線の場合には平均輝度値に -1 を乗算してピーク...

1 year ago | 2

| accepted

Answered
バイナリ画像における水平方向の白領域の広がりを測定したいです。
regionprops で重心を計算する際に、あわせて Bounding Box を計算しておいて、そのボックスの幅を「体領域における水平方向の幅」と見なせないでしょうか? % 重心の描写 % s = regionprops(binary1,'cent...

1 year ago | 2

| accepted

Answered
headerが複数階層のcsvファイルを構造的に読み込む方法
readcell でまずファイル全体を読み込んだ後、変数名に関する部分と数値データの部分を分けて、最後にテーブル型変数として纏めるという方法はいかがでしょうか?以下はその一例です。 % readcell でとりあえず全体を読み込む C = readce...

1 year ago | 1

| accepted

Answered
How to obtain the outermost elements of a 2D matrix ?
How about the following? % Sample matrix M = magic(5); % Replace non-outermost element as NaN M(2:end-1, 2:end-1) = nan; ...

1 year ago | 2

| accepted

Answered
Rawデータをjpgに変換したいです
関連する関数 raw2rgb, imresize, imwrite を順に適用することで実現可能かと思います。

1 year ago | 1

| accepted

Answered
画像をパディングし正方形にする方法
関数 padarray を使って、以下のようにする方法はいかがでしょうか? % サンプル画像 (1000×200ピクセル) I_in = randi(255, [1000 200], "uint8"); % 縦横のピクセル数とその差を取得 sz...

1 year ago | 1

| accepted

Answered
エラーバーを任意の点だけ表示する方法はありませんか
plot と errorbar を同じ色で重ねて表示する方法はいかがでしょうか? たとえば 25個の (x,y) データがあり、5, 10, 15, 20番目のデータのみにエラーバーを表示したいとすると、以下のようになります。 % データ x = 1...

1 year ago | 0

| accepted

Answered
saving 3 dimensional data in excel file in a particular format
How about the following? for kk = 1:5 writematrix(squeeze(A(kk,:,:)), "yourExcel.xlsx", "Sheet", kk); end

1 year ago | 1

| accepted

Answered
x, yの実験データに対し、x,yを両辺に複数もつ複雑な理論式(x,yを変数とし、未知の係数を含む関数)によってフィッティングする方法を教えてください。
いくつかやり方がありますが、たとえば (x, y) の全データに対する左辺と右辺の差の二乗和を「 (a, b) を入力変数とする関数」として定義して、fminsearch で (a, b) の最適値を求めるというのはいかがでしょうか?

1 year ago | 0

Answered
Using load for different files with varying names
How about the following? for kk = 1:25 fileName = sprintf('data%d.mat', kk); load(fileName) % % Some proce...

1 year ago | 1

| accepted

Answered
円を配列で表す
いろいろなやり方があると思いますが、たとえばMATLABの基本関数のみを使う以下の方法はいかがでしょうか? % 初期配列 J = repmat(6.5, 710, 710); % 中心 (335, 335), 半径 135 の円内のグリッド点を示...

1 year ago | 3

| accepted

Answered
Find value based on adjacent value condition and insert into new variable
ismember function will be helpful for this task, like: % Sample matrix A = [(0:50)', rand(51,1)]; % Second matrix with inde...

1 year ago | 1

| accepted

Answered
Rename a lot of files
How about the following? fileList = dir('*.csv'); for kk = 1:numel(fileList) fileNum = extractBetween(fileList(kk).name,'...

1 year ago | 1

Answered
Trying to plot a temperature distribution and generate a temperature contourn!
How about the following? L = 1; W = 1; [xGrid, yGrid] = meshgrid(0:0.025:1, 0:0.025:1); T = zeros(size(xGrid)); for n =...

1 year ago | 2

| accepted

Answered
How to find the midpoint between two curves in an image
How abou the following? % Load image I = imread('https://jp.mathworks.com/matlabcentral/answers/uploaded_files/1079075/curve.P...

1 year ago | 1

| accepted

Answered
I need to repeat numbers in an array with a certain number of repetitions for each value without(repelem or repmat)
I'm not sure why you do not prefer repelem/repmat... Anyway, how about the following solution? % Example list_1 = [2;3;5;6]; ...

1 year ago | 2

| accepted

Answered
Trouble using split function in matlab
How about the following? % Example dates = {'3/11/9102'; '3/12/9102'; '3/13/9102'; '3/14/9102'; '3/15/9102'}; % Split by '/...

1 year ago | 2

| accepted

Answered
Find the missing rows and newly added rows in two different excels sheets
How about the following? % Load the Excel files tNew = readtable('https://jp.mathworks.com/matlabcentral/answers/uploaded_file...

1 year ago | 2

| accepted

Answered
MPR-CTを読み込んで3Dとし、一部を球近似することはできますか?
MPR-CT画像から既に 3D モデルは作成済みだと想定します。 3D モデルが 3次元のバイナリイメージの形で利用可能だとすると、regionprops3 関数を使ってそれぞれの重心座標を算出できます。また、この関数でボリュームサイズも取得できますので...

1 year ago | 0

Answered
Average of every 25 rows in a table
Another possible solution: % Sample data data = rand(1000, 10); % Grouping group = repelem(1:size(data, 1)/25, 25)'; % ...

1 year ago | 1

Answered
ベクトルと平面のなす角の算出
順を追って説明します。 まず、ベクトル a と b のなす角は以下の式で求められます。 では平面とベクトル a のなす角は??というご質問ですが、考えてみると平面の法線ベクトルを使って求められそうです。 たとえば平面の法線ベクトルを n とすると...

2 years ago | 2

Load more