Réponse apportée
xlsreadをreadcellに置き換え時の空白データの処理
1行目に変数名、2行目以降にデータが入っているということであれば、readtable 関数が適しているかと思います。もし変数名が日本語などの場合は、以下のように 'PreserveVariableNames' オプションを true に設定することでうまく...

plus de 3 ans il y a | 0

Réponse apportée
行列から条件を指定して値を取り出す
以下のような方法はいかがでしょうか? A = [1 2 3 4 5 6 7; 0 1 1 0 1 1 0]; idx = [0 diff(A(2,:))] == 1; B = A(1,idx); 結果: >> B B = 2 ...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
using readtable to convert columns containing dates to datetime
Like this? T = readtable('US_Presidents.xlsx','PreserveVariableNames',true); T.("Birth Date") = datetime(T.("Birth Date")); T...

plus de 3 ans il y a | 0

Réponse apportée
Combining and sorting two meshgrids
How about the following? Xall = [X1(:); X2(:); X3(:); X4(:)]; Yall = [Y1(:); Y2(:); Y3(:); Y4(:)]; vall = [v1(:); v2(:); v3(:...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
cell array with numeric values only
Another possible solution: C = {'long: 151.125#';'long: 151.126#'}; V = regexp(C,'[?\d.]+','match','once'); V = str2double(V)...

plus de 3 ans il y a | 0

Réponse apportée
How to plot 4 different backgrounds in a figure?
How about using uipanel? The following is an example: % Sample colormap cMap = rand(4,3); % Graphic object array hPanel =...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
Determine the intensity value, "T", in a 2D image for which 99.9% of all intensity values are less than "T"
I believe prctile function will be helpful to this task, like: % Read sample gray scale image I = imread('cameraman.tif'); ...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
Series of rectangular pulses with increasing pulse length
How about using modulate function (Signal Processing Toolbox)? The following is an example: fs = 100; fc = 5; data = 0:0.2:1...

plus de 3 ans il y a | 0

Réponse apportée
all possible combination between matrices
Seems to be an interesting 'puzzle'. Though this is not so smart, how about the following? %% Data A = {[2,1],[0,6],[4,2]}; ...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
excelデータのインポートに関して
以下の方法ではいかがでしょうか? A = readmatrix('sample.xlsx'); C = mat2cell(A,ones(1,size(A,1))); >> C C = 4×1 の cell 配列 {1×5 d...

plus de 3 ans il y a | 1

| A accepté

Réponse apportée
Contour plots with irregular grids
How about the following? % Read data file tData = readtable('data.xlsx'); tData.Properties.VariableNames = {'x','y','TEMP'}; ...

plus de 3 ans il y a | 4

| A accepté

Réponse apportée
原点と座標から角度
後半のご質問は、atan2d 関数を使うことで解決できます。ただし -180 ~ +180 度の値を返すので、これを 0 ~ 360 度に変換する必要があります。たとえば以下のようなやり方はいかがでしょうか? % 例として、x軸とベクトル (x,y) =...

plus de 3 ans il y a | 0

Réponse apportée
行列の重複している行を削除する方法
unique 関数の順序フラグを 'stable' に指定することで実現可能かと思います。 A = [1, 0, 1, 1, 1 ; 0, 1, 1, 0, 0 ; 0, 0, 0, 1, 1 ; 1, 0, 1, 1, 1 ; 1, 1, 0, 1, ...

presque 4 ans il y a | 1

| A accepté

Réponse apportée
Color map from green to red
You can create your original colormap (green to red) and apply to the data. The following is an example: % Create green-to-red...

presque 4 ans il y a | 2

| A accepté

Réponse apportée
Sum elements of corresponding equal elements
How about the following solution? % Create sample 36-by-3 array C rng('default'); % for reproducab...

presque 4 ans il y a | 0

| A accepté

Réponse apportée
Select values from martix with an absolute value and set them to zero.
Like this? A = randi([-10 10],6); % 6x6 matrix (ranging from [-10,10]) idx = abs(A) == 5; % Find elements whose absolute...

presque 4 ans il y a | 0

| A accepté

Réponse apportée
極座標のヒストグラムを作製
polarhistogram 関数を使うと極座標でのヒストグラムを作成できます。 たとえば8等分した角度ごとの測定値をプロットする場合、以下のようになるかと思います。 % 8等分した角度(theta)と測定値(val)の模擬データ theta = 0...

presque 4 ans il y a | 1

Réponse apportée
配列の各要素を別の配列の変数として定義したい.
詳細な説明、ありがとうございます。 それでは、以下のような方法ではいかがでしょうか? A = [1 0.1 0.01]; B = zeros(1,4); % ベクトルBを初期値0で作成 n = numel(A); % ベクト...

presque 4 ans il y a | 0

Réponse apportée
MATLABでファイルのサイズを取得したい
dir 関数が使えるかと思います。 たとえば以下のようにすると、data.xlsのファイルサイズ [bytes] が変数 t_fileSize に格納されます。 s = dir('data.xls'); t_fileSize = s.bytes;

presque 4 ans il y a | 1

| A accepté

Réponse apportée
2次元上で楕円を描くにはどのようにしたらよいでしょうか。
いろいろなやり方がありますが、たとえば陰関数をプロットする fimplicit 関数を使う方法はいかがでしょうか? 一例として、楕円をあらわす方程式 (x/a)^2 + (y/b)^2 = 1 を a=5, b=2 としてプロットすると以下のようになりま...

presque 4 ans il y a | 0

Réponse apportée
グレースケール化のエラー
おそらく、もとの画像ファイルがインデックス付き画像ファイルになっていることが原因と思われます。 その場合、以下のようにいったん通常のRGB画像に変換したうえでグレースケール化すれば大丈夫です。 [IDX, cmap] = imread('2007_00...

presque 4 ans il y a | 0

| A accepté

Réponse apportée
correlation of signals and finding time delays
If you have Signal Processing Toolbox, please try finddelay function.

presque 4 ans il y a | 0

| A accepté

Réponse apportée
角度の求め方
アークコサイン(逆余弦関数)を使って求めることができます。MATLABの関数としては、acos 又は acosd になります。出力される角度θを、前者はラジアン、後者は度として出力します。 % 例: cos(θ) = 0.5 のθを求める theta_...

presque 4 ans il y a | 0

| A accepté

Réponse apportée
重複したデータを削除する方法
findgroups と splitapply を使う方法はいかがでしょうか? A = [600 142 30 75 13; 600 141 30 75 14; 600 142 30 80 14]; group = findgroups(A(:,4))...

presque 4 ans il y a | 1

| A accepté

Réponse apportée
plot3でのエラー解決方法
waterfall 関数を使って、ウォーターフォールプロットとして可視化するというのは如何でしょうか? 以下は簡単な例です。 % Sample data t = 0:0.1:20; data = zeros(7,numel(t)); for kk...

presque 4 ans il y a | 0

Réponse apportée
How to binarize a grayscale image with multiple thresholds?
Assuming a grayscale image img is a 2D double array, the following code should work: b = img > t1 | img < t2;

presque 4 ans il y a | 0

| A accepté

Réponse apportée
二次元グラフのグラデーション方法
scatter 関数の第4引数で各ポイントの色をコントロールすることができます。例えばご質問のプログラムですと、以下のようになります。 scatter関数の詳細は以下をご参照ください。 https://jp.mathworks.com/help/mat...

presque 4 ans il y a | 0

Réponse apportée
Plotting target points within an n radius plot
How about the following solution? % Data points (N = 10, for example.) numPoints = 10; detRange = 2*pi*(rand(numPoints,1)); ...

presque 4 ans il y a | 0

| A accepté

Réponse apportée
Hi I need help with for loop
No need to use for-loop. How about the following way? % Read data file T1 = readtable('A1_input.txt'); % Postion of (x,y) a...

presque 4 ans il y a | 0

Réponse apportée
Remove noise from image
How about applying median filter? The following is an example: % Read the image and convert it to grya-scale I = imread('gray...

presque 4 ans il y a | 1

| A accepté

Charger plus