Answered

Find the list of edges between 2 nodes

How about the following? tail = [1 2 2 4 5 3]; head = [2 4 5 3 3 6]; % Create graph object G = graph(head,tail); % Find...

Find the list of edges between 2 nodes

How about the following? tail = [1 2 2 4 5 3]; head = [2 4 5 3 3 6]; % Create graph object G = graph(head,tail); % Find...

3 jours ago | 0

Answered

How to increase elements of a vector, of different size, without changing its plot?

OK. Then, I would recommend converting your data into timetable, and applying synchronize and/or retime function. The followin...

How to increase elements of a vector, of different size, without changing its plot?

OK. Then, I would recommend converting your data into timetable, and applying synchronize and/or retime function. The followin...

4 jours ago | 1

| accepted

Answered

Spiting Cell Array into Different Delimiter Numbers

How about the following? % Example of the input array Act = repmat({'Dive';'Run';'Walk'},4,1); uniqueAct = unique(Act); Co...

Spiting Cell Array into Different Delimiter Numbers

How about the following? % Example of the input array Act = repmat({'Dive';'Run';'Walk'},4,1); uniqueAct = unique(Act); Co...

5 jours ago | 0

| accepted

Answered

search for a word in a string with complete match

How about the following way? StringText = 'High rotation speed changes the parameter RevolutionChange'; WordCell = {'Slip' , '...

search for a word in a string with complete match

How about the following way? StringText = 'High rotation speed changes the parameter RevolutionChange'; WordCell = {'Slip' , '...

5 jours ago | 1

| accepted

Answered

Matrix rows and columns swapping

I don't think rows and column can be randomly changed simultaneously. There should be at least 2 steps, like this: % Input 3-b...

Matrix rows and columns swapping

I don't think rows and column can be randomly changed simultaneously. There should be at least 2 steps, like this: % Input 3-b...

5 jours ago | 0

Answered

3Dグラフについて

元データであるExcelファイルの各行のデータを、表示している表面プロット上に点として表示するのはいかがでしょうか？ figure surf(X,Y,Z) hold on scatter3(x,y,z,'ro')

3Dグラフについて

元データであるExcelファイルの各行のデータを、表示している表面プロット上に点として表示するのはいかがでしょうか？ figure surf(X,Y,Z) hold on scatter3(x,y,z,'ro')

5 jours ago | 0

| accepted

Answered

Finding Closed area in a region

By using polyshape, simplify and regions functions, you can obtain polyshape object for each closed area. The following is an ex...

Finding Closed area in a region

By using polyshape, simplify and regions functions, you can obtain polyshape object for each closed area. The following is an ex...

6 jours ago | 0

Answered

Vary the thickness of plot

How about using daspect function? The following is an example. d1 = rand(1,10); d2 = rand(1,10)*10; figure ax1 = subplot(...

Vary the thickness of plot

How about using daspect function? The following is an example. d1 = rand(1,10); d2 = rand(1,10)*10; figure ax1 = subplot(...

6 jours ago | 0

Answered

Add object to an image

Like this? % Read background and man image Ibg = imread('img2.jpg'); Iman = imread('img.jpg'); % Adjust man's image size t...

Add object to an image

Like this? % Read background and man image Ibg = imread('img2.jpg'); Iman = imread('img.jpg'); % Adjust man's image size t...

9 jours ago | 2

| accepted

Answered

deleting part of chars

Like this? % Random string with 100 A-Z characters str = char(randi([65 90],1,100)); % Start position (random number betwee...

deleting part of chars

Like this? % Random string with 100 A-Z characters str = char(randi([65 90],1,100)); % Start position (random number betwee...

11 jours ago | 1

| accepted

Answered

Matlabでしりとりをするには

しりとりをするには、少なくとも「単語」「読みの最初の文字」「読みの最後の文字」の3列から成る単語帳が必要になるように思います。さらに、一回使った単語は以降使わないようにするため、既出かどうかを記録するための列もあったほうが良さそうです。 たとえば以下のよ...

Matlabでしりとりをするには

しりとりをするには、少なくとも「単語」「読みの最初の文字」「読みの最後の文字」の3列から成る単語帳が必要になるように思います。さらに、一回使った単語は以降使わないようにするため、既出かどうかを記録するための列もあったほうが良さそうです。 たとえば以下のよ...

11 jours ago | 4

| accepted

Answered

How to plot data as a time series in a figure

How about the following? T = readtable('data.txt','HeaderLines',3,'ReadVariableNames',false); T.Properties.VariableNames = {'T...

How to plot data as a time series in a figure

How about the following? T = readtable('data.txt','HeaderLines',3,'ReadVariableNames',false); T.Properties.VariableNames = {'T...

18 jours ago | 0

| accepted

Answered

Add missing rows to the table without loop

Like this? % Original table Tbefore = array2table([0 25 12 12 0.08; 0 33 1 1 0.0051],... 'VariableNames',{'time','radius','...

Add missing rows to the table without loop

Like this? % Original table Tbefore = array2table([0 25 12 12 0.08; 0 33 1 1 0.0051],... 'VariableNames',{'time','radius','...

18 jours ago | 0

| accepted

Answered

simple random time series

How about the following? N = [1000 , 500 , 2000 , 300 , 700 , 1000]; % No of samples NI = length(N); y_min = 10 + (60-10)*r...

simple random time series

How about the following? N = [1000 , 500 , 2000 , 300 , 700 , 1000]; % No of samples NI = length(N); y_min = 10 + (60-10)*r...

19 jours ago | 0

Answered

Plotting an array of string as X-axis and an array of numbers as y-axis?

Assuming your data was stored in the attached format, I think there should be at least following 2 solutions: % Read data data...

Plotting an array of string as X-axis and an array of numbers as y-axis?

Assuming your data was stored in the attached format, I think there should be at least following 2 solutions: % Read data data...

23 jours ago | 0

Answered

How can I edit a value in multiple text files?

I believe it's better to keep the original files and save the revised files to a different folder. How about the following? In...

How can I edit a value in multiple text files?

I believe it's better to keep the original files and save the revised files to a different folder. How about the following? In...

23 jours ago | 0

Answered

Adding two arrays of different sizes together evenly without messing cumulative sum.

Based on the question, C should be a cumulative result starting from 0. So, it should be: C = A + linspace(0,B,length(A));

Adding two arrays of different sizes together evenly without messing cumulative sum.

Based on the question, C should be a cumulative result starting from 0. So, it should be: C = A + linspace(0,B,length(A));

24 jours ago | 0

Answered

grouping numbers in matrix

More generalized solution would be: C = splitapply(@(x){x'}, B, A); If each group has the same number of elements, the followi...

grouping numbers in matrix

More generalized solution would be: C = splitapply(@(x){x'}, B, A); If each group has the same number of elements, the followi...

25 jours ago | 1

| accepted

Answered

how to multiply a number in even rows of matrix?

Please try the following: output2(:,2:2:end) = 2;

how to multiply a number in even rows of matrix?

Please try the following: output2(:,2:2:end) = 2;

27 jours ago | 0

| accepted

Answered

4d plot in order to create a surface with density from 4 vectors ( coordinates of the dots). X, Y, Z and C is the color.

OK. Then, how about the following? % Load data load('object.mat') % Create meshgrid [xq, yq, zq] = meshgrid(min(x):5:max(x...

4d plot in order to create a surface with density from 4 vectors ( coordinates of the dots). X, Y, Z and C is the color.

OK. Then, how about the following? % Load data load('object.mat') % Create meshgrid [xq, yq, zq] = meshgrid(min(x):5:max(x...

27 jours ago | 1

| accepted

Answered

4d plot in order to create a surface with density from 4 vectors ( coordinates of the dots). X, Y, Z and C is the color.

How about simply using scatter3 function, like: load('object.mat') figure scatter3(x,y,z,[],c,'.') colorbar

4d plot in order to create a surface with density from 4 vectors ( coordinates of the dots). X, Y, Z and C is the color.

How about simply using scatter3 function, like: load('object.mat') figure scatter3(x,y,z,[],c,'.') colorbar

29 jours ago | 1

Answered

regionpropsの応用について。

bwboundaries 関数を使うのはいかがでしょうか？ たとえば以下のようにオブジェクトの境界をトレースできます。 % Sample binary image I = imread('toyobjects.png'); BW = ~imbina...

regionpropsの応用について。

bwboundaries 関数を使うのはいかがでしょうか？ たとえば以下のようにオブジェクトの境界をトレースできます。 % Sample binary image I = imread('toyobjects.png'); BW = ~imbina...

environ un mois ago | 0

| accepted

Answered

ignore or delete number or row has been multiply defined?

Simple solution will be: result = unique(yourArray); If you want to keep element's order, please try the following: [~, ia] =...

ignore or delete number or row has been multiply defined?

Simple solution will be: result = unique(yourArray); If you want to keep element's order, please try the following: [~, ia] =...

environ un mois ago | 0

| accepted

Answered

Timetable Monthly Average over Many Years

Looking at your csv data, some additional options will be needed. (1) To specify the delimiter in your csv data, 'Delimiter' op...

Timetable Monthly Average over Many Years

Looking at your csv data, some additional options will be needed. (1) To specify the delimiter in your csv data, 'Delimiter' op...

environ 2 mois ago | 1

Answered

change numbering inside cell

Solution 1: c_new = cell(size(c)); for kk = 1:numel(c) c_new{kk} = interp1(B(:,2),B(:,1),c{kk}); end Solution 2: % "...

change numbering inside cell

Solution 1: c_new = cell(size(c)); for kk = 1:numel(c) c_new{kk} = interp1(B(:,2),B(:,1),c{kk}); end Solution 2: % "...

environ 2 mois ago | 0

| accepted

Answered

Extract integer number from a cell array.

If my understanding is correct, you are trying to extract numbers just after 'BUS'. If so, how about the following? % Original...

Extract integer number from a cell array.

If my understanding is correct, you are trying to extract numbers just after 'BUS'. If so, how about the following? % Original...

environ 2 mois ago | 0

| accepted

Answered

Graph each side of the equation

How about using fzero function? The following is an example: % fnc = (left side) - (right side) fnc = @(x) 4.231*x - exp(-0.17...

Graph each side of the equation

How about using fzero function? The following is an example: % fnc = (left side) - (right side) fnc = @(x) 4.231*x - exp(-0.17...

environ 2 mois ago | 1

| accepted

Answered

How can I set a descend order finding peaks to my graph ?

How about combining envelope and findpeaks functions? The following is an example. % Load data load('signal.mat'); load('t.m...

How can I set a descend order finding peaks to my graph ?

How about combining envelope and findpeaks functions? The following is an example. % Load data load('signal.mat'); load('t.m...

environ 2 mois ago | 2

| accepted

Answered

How to take monthly flow data and obtain annual max flow values

Assuming your data was stored in 972-by-2 matrix yourData, following code can do your task. year = repelem([1:81]',12,1); year...

How to take monthly flow data and obtain annual max flow values

Assuming your data was stored in 972-by-2 matrix yourData, following code can do your task. year = repelem([1:81]',12,1); year...

environ 2 mois ago | 0

Answered

Remove the border lines.

How about using surf function with 'FaceColor' = 'interp' option, instead. Here is an example. figure surf(xx1,yy1,z1,'FaceCo...

Remove the border lines.

How about using surf function with 'FaceColor' = 'interp' option, instead. Here is an example. figure surf(xx1,yy1,z1,'FaceCo...

environ 2 mois ago | 0