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

más de 7 años hace | 0

| aceptada

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

más de 7 años hace | 1

| aceptada

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

más de 7 años hace | 0

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

más de 7 años hace | 0

| aceptada

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

más de 7 años hace | 0

| aceptada

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

más de 7 años hace | 0

| aceptada

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

más de 7 años hace | 0

| aceptada

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

más de 7 años hace | 3

| aceptada

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

más de 7 años hace | 0

| aceptada

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

más de 7 años hace | 2

| aceptada

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

más de 7 años hace | 0

| aceptada

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

más de 7 años hace | 0

| aceptada

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

más de 7 años hace | 0

| aceptada

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

más de 7 años hace | 0

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

más de 7 años hace | 0

| aceptada

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

más de 7 años hace | 0

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

más de 7 años hace | 0

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

más de 7 años hace | 1

| aceptada

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

más de 7 años hace | 0

| aceptada

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

más de 7 años hace | 0

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

más de 7 años hace | 2

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

más de 7 años hace | 0

| aceptada

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

más de 7 años hace | 0

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

más de 7 años hace | 2

| aceptada

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

más de 7 años hace | 0

| aceptada

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

más de 7 años hace | 0

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

más de 7 años hace | 0

| aceptada

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

más de 7 años hace | 1

| aceptada

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

más de 7 años hace | 1

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

más de 7 años hace | 0

Cargar más