답변 있음

Counting consecutive repeat values for each row in matrix

It's a job for the image processing toolbox, in particular bwconncomp (with a custom connectivity): cc = bwconncomp(~yourphoto,...

Counting consecutive repeat values for each row in matrix

It's a job for the image processing toolbox, in particular bwconncomp (with a custom connectivity): cc = bwconncomp(~yourphoto,...

약 16시간 전 | 1

답변 있음

Calculate connected graph components of "merged graphs" (graph union)

Assuming you want that identical nodes are nodes with the same X and Y coordinates, then first I'd add these coordinates to the ...

Calculate connected graph components of "merged graphs" (graph union)

Assuming you want that identical nodes are nodes with the same X and Y coordinates, then first I'd add these coordinates to the ...

약 24시간 전 | 1

| 수락됨

답변 있음

How to arrange time series data into yearly groups?

A simpler and faster way of obtaining the same as Joe's answer: dataInitial = readtimetable('Data.xlsx'); dataFinal = table(da...

How to arrange time series data into yearly groups?

A simpler and faster way of obtaining the same as Joe's answer: dataInitial = readtimetable('Data.xlsx'); dataFinal = table(da...

1일 전 | 0

| 수락됨

답변 있음

Using strrep for matrix

Keeping your 2d character array as is: yourarray(ismember(yourarray, 'hood', 'rows'), :) = []; or yourarray(all(yourarray == ...

Using strrep for matrix

Keeping your 2d character array as is: yourarray(ismember(yourarray, 'hood', 'rows'), :) = []; or yourarray(all(yourarray == ...

1일 전 | 0

답변 있음

How to check whether any two elements are equal or not in a Nx1 array in matlab?

x = [1 2 3 4 2 5 6 3 7 8 9 10]; %demo data. Works with column or row vectors [loc1, loc2] = find(tril(x == x.', -1)); %loca...

How to check whether any two elements are equal or not in a Nx1 array in matlab?

x = [1 2 3 4 2 5 6 3 7 8 9 10]; %demo data. Works with column or row vectors [loc1, loc2] = find(tril(x == x.', -1)); %loca...

1일 전 | 2

| 수락됨

답변 있음

Average of two consecutive rows and importantly average of first and last row.

You have to be careful with the terminology you use. structures aren't tabular, they don't have columns and rows (well, they can...

Average of two consecutive rows and importantly average of first and last row.

You have to be careful with the terminology you use. structures aren't tabular, they don't have columns and rows (well, they can...

1일 전 | 0

답변 있음

Strip comments from code read from file identifier

The only way to do this is to write a parser that can parse whichever language you're planning to support. At the very least, yo...

Strip comments from code read from file identifier

The only way to do this is to write a parser that can parse whichever language you're planning to support. At the very least, yo...

1일 전 | 0

답변 있음

Accessing field data in nonscalar structure array

This is one of the reason I dislike multilevel structures (the other being they're very inefficient memory-wise), there's no eas...

Accessing field data in nonscalar structure array

This is one of the reason I dislike multilevel structures (the other being they're very inefficient memory-wise), there's no eas...

3일 전 | 2

답변 있음

Using Matlab to Organize Excel Data into Separate Columns

It's trivial to do with unstack: demodata = table(repelem({'Object1'; 'Object2'}, 3), repmat({'X'; 'Y'; 'Z'}, 2, 1), rand(6, 1)...

Using Matlab to Organize Excel Data into Separate Columns

It's trivial to do with unstack: demodata = table(repelem({'Object1'; 'Object2'}, 3), repmat({'X'; 'Y'; 'Z'}, 2, 1), rand(6, 1)...

3일 전 | 1

| 수락됨

답변 있음

Have data in subfolders available

Firstly, it's not a good idea to mix code and data folder. The two should be completely separate, so that your code can work reg...

Have data in subfolders available

Firstly, it's not a good idea to mix code and data folder. The two should be completely separate, so that your code can work reg...

3일 전 | 1

| 수락됨

답변 있음

Distance between two point with the same value

Assuming euclidean distance metric: n = randi(3, 10); %demo input vals = unique(n); %get unique values in n mdistances =...

Distance between two point with the same value

Assuming euclidean distance metric: n = randi(3, 10); %demo input vals = unique(n); %get unique values in n mdistances =...

3일 전 | 1

| 수락됨

답변 있음

Preprocessing using readtable()

Assuming you don't know which rows of the text file correspond to your start and end timestamps, what you want cannot be achieve...

Preprocessing using readtable()

Assuming you don't know which rows of the text file correspond to your start and end timestamps, what you want cannot be achieve...

3일 전 | 1

| 수락됨

답변 있음

Why does the for loop give wrong answer

For a start make sure that your numbers are all in the correct units. It looks like your density is in SI () but your pressure c...

Why does the for loop give wrong answer

For a start make sure that your numbers are all in the correct units. It looks like your density is in SI () but your pressure c...

4일 전 | 0

| 수락됨

답변 있음

Extracting lower triangle excluding the main diagonal elements to a string

B = strjoin(arrayfun(@(row) strjoin(compose('%d', A(row, 1:row-1)), ' '), 2:size(A, 1), 'UniformOutput', false), '\n') is one w...

Extracting lower triangle excluding the main diagonal elements to a string

B = strjoin(arrayfun(@(row) strjoin(compose('%d', A(row, 1:row-1)), ' '), 2:size(A, 1), 'UniformOutput', false), '\n') is one w...

4일 전 | 1

| 수락됨

답변 있음

How I do evaluate a function handle in other function handle

Your y_p never changes in your function. It's always the original . Shouldn't y_p be reevaluated at each step? Your 0.0001 delt...

How I do evaluate a function handle in other function handle

Your y_p never changes in your function. It's always the original . Shouldn't y_p be reevaluated at each step? Your 0.0001 delt...

6일 전 | 0

답변 있음

Compute two matrices with different sizes and different values

it seems to me that the simplest and most reliable solution is to interpolate both velocity matrices to the same grid. Of course...

Compute two matrices with different sizes and different values

it seems to me that the simplest and most reliable solution is to interpolate both velocity matrices to the same grid. Of course...

6일 전 | 0

| 수락됨

답변 있음

Error using copyfile No matching files were found.

I'd replace idx = strfind(myfile(i).name,'_thumb'); if ~isempty(idx) %do nothing else by the simpler ...

Error using copyfile No matching files were found.

I'd replace idx = strfind(myfile(i).name,'_thumb'); if ~isempty(idx) %do nothing else by the simpler ...

6일 전 | 0

| 수락됨

답변 있음

Extract values from a matrix

mean(yourmatrix(yourmatrix >= 3)) %mean of all values greater than or equal to 3

Extract values from a matrix

mean(yourmatrix(yourmatrix >= 3)) %mean of all values greater than or equal to 3

6일 전 | 1

| 수락됨

답변 있음

Create two fprintf in two diferent lines

You seem to be aware that '\n' is a newline so why don't you use it? fprintf('\n B1 \t B2 \t B3\t B4 \t B5\n'); %\n added a...

Create two fprintf in two diferent lines

You seem to be aware that '\n' is a newline so why don't you use it? fprintf('\n B1 \t B2 \t B3\t B4 \t B5\n'); %\n added a...

6일 전 | 1

| 수락됨

답변 있음

how to create an error message when invalid data is input and then prompt to re-enter the data

Typical pattern for this is: value = someinvalidvalue; while valueisinvalid value = input('Enter value'); end Note ...

how to create an error message when invalid data is input and then prompt to re-enter the data

Typical pattern for this is: value = someinvalidvalue; while valueisinvalid value = input('Enter value'); end Note ...

7일 전 | 0

답변 있음

Help with Simple OOP Program

As Thomas said, the kind of class you're developing would works better as a handle class. Note that if you derive from handle y...

Help with Simple OOP Program

As Thomas said, the kind of class you're developing would works better as a handle class. Note that if you derive from handle y...

7일 전 | 0

| 수락됨

답변 있음

Regionprops returning "wrong" axis lengths

That's because all the ellipse properties are not designed for hollow shapes. Matlab is trying to fit an ellipse just to the 'on...

Regionprops returning "wrong" axis lengths

That's because all the ellipse properties are not designed for hollow shapes. Matlab is trying to fit an ellipse just to the 'on...

9일 전 | 1

| 수락됨

답변 있음

Average in a 1D array

Assumming the number of elements of the vectors is a multiple of n, reshape the vector in columns of n rows and take the mean ac...

Average in a 1D array

Assumming the number of elements of the vectors is a multiple of n, reshape the vector in columns of n rows and take the mean ac...

9일 전 | 1

답변 있음

structure contains multiple cells with different variables in them I would like to remove variables not present in all cells

%identify common fields commonfields = fieldnames(data{1}); for cidx = 2:numel(data) commonfields = intersect(commonfield...

structure contains multiple cells with different variables in them I would like to remove variables not present in all cells

%identify common fields commonfields = fieldnames(data{1}); for cidx = 2:numel(data) commonfields = intersect(commonfield...

9일 전 | 0

| 수락됨

답변 있음

Replace letters in matrix

I would be wary of using regexprep as per Walter's code for that. It relies on the fact that replacements are attempted in the o...

Replace letters in matrix

I would be wary of using regexprep as per Walter's code for that. It relies on the fact that replacements are attempted in the o...

9일 전 | 0

답변 있음

accessing large MAT file

See the limitations section of matfile to see what it can and can't do. In particular, the granularity of matfile is typically a...

accessing large MAT file

See the limitations section of matfile to see what it can and can't do. In particular, the granularity of matfile is typically a...

10일 전 | 0

답변 있음

Finding values within a matrix

It appears that you are building your code from bits you've asked or found without really understanding how it works. In particu...

Finding values within a matrix

It appears that you are building your code from bits you've asked or found without really understanding how it works. In particu...

10일 전 | 0

| 수락됨

답변 있음

How to parse a table (in a text file) into matlab cell array where we have some missing values?

Your file appears to have fixed width fields. the easiest way to import such files is with FixedWidthImportOptions, e.g.: opts ...

How to parse a table (in a text file) into matlab cell array where we have some missing values?

Your file appears to have fixed width fields. the easiest way to import such files is with FixedWidthImportOptions, e.g.: opts ...

10일 전 | 0

답변 있음

[Solved] How can I make my output into a 2D char array instead of separate answers?

My idea was to concatenate each line, but it doesn't seem possible without resetting Well, you're doing assignment which indeed...

[Solved] How can I make my output into a 2D char array instead of separate answers?

My idea was to concatenate each line, but it doesn't seem possible without resetting Well, you're doing assignment which indeed...

13일 전 | 1

답변 있음

Montage from a cell array of image file names

Note that you can look at the code of montage to see what it does. As Praveen commented, it's not clear what final image size yo...

Montage from a cell array of image file names

Note that you can look at the code of montage to see what it does. As Praveen commented, it's not clear what final image size yo...

13일 전 | 0

| 수락됨