Answered

how can I edit a matrix and rename it at the same time?

Sorry, you're better off doing it in two lines. You want to copy the matrix into the new variable before changing it so: edited...

how can I edit a matrix and rename it at the same time?

Sorry, you're better off doing it in two lines. You want to copy the matrix into the new variable before changing it so: edited...

10 jours ago | 0

| accepted

Answered

Copy the content of one table to an other table with different size

This is trivially done with outerjoin: mergedtable = outerjoin(yourbigtable, yourgroupcounttable, 'Keys', {'Time', 'radius'}, '...

Copy the content of one table to an other table with different size

This is trivially done with outerjoin: mergedtable = outerjoin(yourbigtable, yourgroupcounttable, 'Keys', {'Time', 'radius'}, '...

10 jours ago | 2

| accepted

Answered

OpeningFcn of AppDesigner Conversion?

I've no idea how the tool converts a GUIDE GUI into an App, but in App Designer all the initialisation code goes in the StartupF...

OpeningFcn of AppDesigner Conversion?

I've no idea how the tool converts a GUIDE GUI into an App, but in App Designer all the initialisation code goes in the StartupF...

10 jours ago | 0

Answered

how can i change an indice in Matrix as vector?

First, probably the most important thing: numbered or sequentially named variables are always a very bad idea. they always make ...

how can i change an indice in Matrix as vector?

First, probably the most important thing: numbered or sequentially named variables are always a very bad idea. they always make ...

10 jours ago | 2

Answered

somebody plz help me with this code. I got an error after run this code is subscript indices must either be real positive integers or logical.

%your code: left=find(difsig==1); raight=find(difsig==-1); So left and the mispelled raight are a vector of indices of di...

somebody plz help me with this code. I got an error after run this code is subscript indices must either be real positive integers or logical.

%your code: left=find(difsig==1); raight=find(difsig==-1); So left and the mispelled raight are a vector of indices of di...

10 jours ago | 0

| accepted

Answered

how to use cell ?

If you're asking how to transform U into your desired F: F = cellfun(@num2cell, U, 'UniformOuput', false); would be one way of...

how to use cell ?

If you're asking how to transform U into your desired F: F = cellfun(@num2cell, U, 'UniformOuput', false); would be one way of...

10 jours ago | 1

Answered

fill a boundary region with white colour

boundaries{2} is only two pixels, there's nothing to fill! Anyway, if all you want is to fill the region, then bwboundaries is ...

fill a boundary region with white colour

boundaries{2} is only two pixels, there's nothing to fill! Anyway, if all you want is to fill the region, then bwboundaries is ...

11 jours ago | 1

Answered

How to enforce element-wise condition in matrix operations?

Reposting my comment as an answer and adding a bit more to it. I'm unclear why you want to ignore the 0s in L and why you think...

How to enforce element-wise condition in matrix operations?

Reposting my comment as an answer and adding a bit more to it. I'm unclear why you want to ignore the 0s in L and why you think...

11 jours ago | 1

| accepted

Answered

How to create a grid of evenly spaced ones in a matrix of zeros?

"Is there a more compact or straightforward way to achieve this?" Definitively! %demo data size_array = 500; npoints = 15; ...

How to create a grid of evenly spaced ones in a matrix of zeros?

"Is there a more compact or straightforward way to achieve this?" Definitively! %demo data size_array = 500; npoints = 15; ...

11 jours ago | 0

| accepted

Answered

Random string generation of message

function out_str = rand_string_gen(np, str) out_str = regexprep(str, '.(?!$)', sprintf('$0${char(randi(double(''az''), 1, %...

Random string generation of message

function out_str = rand_string_gen(np, str) out_str = regexprep(str, '.(?!$)', sprintf('$0${char(randi(double(''az''), 1, %...

11 jours ago | 0

Answered

How can I set x=1.1 with 30 decimal precision?

When you do x = 1.1 You create an x of class double. double numbers have a decimal precision of around 16 significant digits. ...

How can I set x=1.1 with 30 decimal precision?

When you do x = 1.1 You create an x of class double. double numbers have a decimal precision of around 16 significant digits. ...

11 jours ago | 1

Answered

splitvars for input arguments of type 'cell'

As per my comment to your other question, it looks like Multico should be a matrix not a cell array. Regardless of its type, wh...

splitvars for input arguments of type 'cell'

As per my comment to your other question, it looks like Multico should be a matrix not a cell array. Regardless of its type, wh...

11 jours ago | 0

| accepted

Answered

Filter contents of a table

Any reason why Multico is a cell array? If all the cells are just scalar, then it's a waste of memory and complicates the code f...

Filter contents of a table

Any reason why Multico is a cell array? If all the cells are just scalar, then it's a waste of memory and complicates the code f...

11 jours ago | 0

| accepted

Answered

Sliding window function over column vector, Help!

"The data has months 7 to 10 and labelled them as M7, M8, M9, M10 to help me remember the months." Do not do that! Numbered var...

Sliding window function over column vector, Help!

"The data has months 7 to 10 and labelled them as M7, M8, M9, M10 to help me remember the months." Do not do that! Numbered var...

11 jours ago | 0

Answered

How to decrease run time in swap operation ?

What's the purpose of the while loop since you know beforehand when it ends and thus how many steps it will do? Assuming that f...

How to decrease run time in swap operation ?

What's the purpose of the while loop since you know beforehand when it ends and thus how many steps it will do? Assuming that f...

12 jours ago | 0

Answered

Group the array with similar strings

It's very unclear what your definition of similar is. Also note that your example A is a char vector, not a string, and that co...

Group the array with similar strings

It's very unclear what your definition of similar is. Also note that your example A is a char vector, not a string, and that co...

12 jours ago | 1

| accepted

Answered

Organize Excel date and time data

It's trivial to sort if you read the data in a table or a timetable: data = readtable('Practice.xlsx', 'ReadVariableNames', fal...

Organize Excel date and time data

It's trivial to sort if you read the data in a table or a timetable: data = readtable('Practice.xlsx', 'ReadVariableNames', fal...

13 jours ago | 0

Answered

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

15 jours ago | 1

Answered

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

15 jours ago | 1

| accepted

Answered

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

15 jours ago | 0

| accepted

Answered

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

16 jours ago | 0

Answered

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

16 jours ago | 2

| accepted

Answered

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

16 jours ago | 0

Answered

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

16 jours ago | 0

Answered

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

17 jours ago | 2

Answered

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

17 jours ago | 1

| accepted

Answered

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

17 jours ago | 1

| accepted

Answered

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

17 jours ago | 1

| accepted

Answered

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

17 jours ago | 1

| accepted

Answered

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

18 jours ago | 0

| accepted