Answered
Replace groups of numbers in a matrix checking connections in 8-directions
This can indeed be easily achieved with <https://www.mathworks.com/help/images/ref/regionprops.html |regionprops|> of the image ...

8 years ago | 0

| accepted

Answered
How to compare a group of values in a data set to each other using vectorization?
Basically you want to find the duration of each run of power drop. As you've already established finding the power drops is a si...

8 years ago | 1

| accepted

Answered
Convert .p to .m
This is not possible. The whole purpose of p code is that you can't get the plain text version.

8 years ago | 0

Answered
How can I rescale an histogram ?
Your code would be so much easier to understand if you'd used meaningful variable names instead of useless |xx|, |yy|, |S|, etc....

8 years ago | 0

| accepted

Answered
xmlwrite : Attributes are alphabetically sorted
_What I need is ...:_ Then what you need is not xml. A compliant xml writer is explicitly allowed to order tags and attribute...

8 years ago | 0

| accepted

Answered
distribution of consecutive numbers
I don't think there's a way t do that without a loop (either explicit or with |arrayfun|). %build list of patterns to searc...

8 years ago | 0

| accepted

Answered
problem of generations of values in a matrix
The first thing your code should do is check if the inputs are compatible and return an throw an error message explaining the pr...

8 years ago | 0

| accepted

Answered
How can I write the Twos complement and return a hex string ?
There's a reason I ask all these questions. I don't believe you've thought properly about what it is you're asking. As I keep sa...

8 years ago | 3

| accepted

Answered
help on: number "or" number = True
|str2num| is a fairly dangerous function to use, in most cases prefer using |str2double|. |str2num| evaluates the expression (it...

8 years ago | 0

| accepted

Answered
Matrix elements where row index higher than column index
sum(sum(tril(M, -1))) is one way to do it.

8 years ago | 2

| accepted

Answered
How to run large SQL statements on new lines
Your question is really about how to input a char vector using more than one line: SQL = ['select table.leg_no ', ... ...

8 years ago | 0

| accepted

Answered
how to convert a matrix mxn to mxnx3?
I suspect what you want is not to turn your point cloud into an image, but simply to plot your point cloud. This is easily achie...

8 years ago | 0

| accepted

Answered
get month of date from string
_what is the problem?_ Your cell array |date| contains some dates that are not valid and are thus converted to NaT (Not a Tim...

8 years ago | 0

| accepted

Answered
Remove specific characters from cell array
* extract elements 2 to 5: cellfun(@(x) x(2:min(end, 5)), yourcellarray, 'UniformOutput', false) the |min(end, 5)| is to...

8 years ago | 0

Answered
Looking for all sub-networks among a network
Please don't post screenshots, particularly as it's trivial to write your matrix as text in the question. We can't copy/paste sc...

8 years ago | 0

| accepted

Answered
Vectorizing gives slightly different solution
There are three problems with your vectorised version: # you repmat |alpha| at each step of the |j| loop. Not critical, just ...

8 years ago | 0

Answered
How do I exclude certain lines from data files?
It sounds like your original code is very fragile. Looking at the portion you show, it's also not very efficient since there's a...

8 years ago | 0

Answered
Could someone explain how this code works?
I'm not sure what there is to explain. <https://www.mathworks.com/help/matlab/ref/ismember.html As documented>, |col| tells you ...

8 years ago | 1

| accepted

Answered
Assignment has more non-singleton rhs dimensions than non-singleton subscripts?
k = 6; A = cellfun(@(edge) find(edge == k), edges, 'UniformOutput', false) The loopy version of that: k = 6; %n ...

8 years ago | 0

| accepted

Answered
Writing a lap time sim tool
Probably, the first thing you need to settle on is what form your inputs will take. If I understand your requirements, I would h...

8 years ago | 0

Answered
Call subfunction many times: Nested or local
As Matt said, there's no function call at all in your 2nd example. Function calls (nested, local, or otherwise) are expensive so...

8 years ago | 2

Answered
Event listener not picking up GUI data
The problem has nothing to do with the name of the GUI. The problem is simply that |guidata| wants a figure handle (or other gra...

8 years ago | 0

| accepted

Answered
find cycle in array
There are no built-in algorithms in matlab to find cycles in graphs (undirected or directed). You'll either have to write your o...

8 years ago | 0

Answered
Facebook data utf-8 string decode
Sorry, I never saw that you finally gave the raw json in your original question. Otherwise, I would have responded. The probl...

8 years ago | 2

| accepted

Answered
How to preallocate memory for storing data in same mat file?
Depending on what |distance1_matlab| does, this code could be significantly improved. I'm also assuming that all files that m...

8 years ago | 0

| accepted

Answered
How to remove the background from an image and only remain the main objects ?
The easiest way to solve your problem is to change your imaging setup by for example using a basket of a significantly different...

8 years ago | 0

Answered
resizing an image not working.
For a greyscale image, your code is correct (as long as the size of the image is even) although note that iterating over rows in...

8 years ago | 0

| accepted

Answered
Why i get the out of bound error in this code?
_Why i get the out of bound error in this code_ Because by the time |b| equals 4, you've removed enough elements from |myset|...

8 years ago | 1

| accepted

Answered
Why is this code "running without output"?
Matlab's editor has live syntax highlighting and error checking. When you write code in the editor, it shows you what can possib...

8 years ago | 1

Answered
How do I add values to a vector instead of replacing them?
All the answers assume you want to create a matrix, I'm not sure that's what you want since you mention a vector. In any case, I...

8 years ago | 0

Load more