Answered
adding next values in an array
M = [1 2 3 -5 -6 2 3]' %demo data M + cumsum([zeros(1, size(M, 2)); M(1:end-1, :)] .* (cumsum(M<0, 1)>1), 1) Will do what...

10 years ago | 1

| accepted

Answered
changing of matrixes in for loop
*Do not* number matrices as you've done. It leads to all sort of problems including the one you're facing. Instead store these m...

10 years ago | 0

| accepted

Answered
How to avoid dynamic variable names with multiple structures?
Assuming the structures are identical in term of field names, the best thing would be to create them as a single structure array...

10 years ago | 1

| accepted

Answered
slicing an array of lines
The increment goes in between the bounds, so it's 4:71:numel(g{1}) %numel is safer than length You don't need a loop ...

10 years ago | 1

| accepted

Answered
Please help with this function
It would be difficult to come up with an *easier* assignment. I assume you've been told how to create a function and if not, sea...

10 years ago | 1

Answered
What script can I use to show the binary version of a photograph. Meaning how can I display the image as only 1s and 0s. Thank you.
Would reshape(cellstr(dec2bin(yourimage, 8)), size(yourimage)) be what you're after? Or maybe: cellfun(@(s) s-'0',...

10 years ago | 0

Answered
How to rotate rows of a matrix?
A version without loop. Not sure it'd be faster than Roger's answer: destcol = 1; %column where the 1 must be located [...

10 years ago | 0

Answered
Can I distribute a library/toolbox of my functions to everyone?
You are free to post / distribute any code you write and put whichever license you wish onto it. Depending on your license, you ...

10 years ago | 0

Answered
How to get a content of a cell array?
_"I have 1x25 cell array, which looks like this :"_ 0.300000 0.410000 ,0.41000 0.430000 ,... _"if I do e.g"_ x=C{1,...

10 years ago | 4

| accepted

Answered
updating gui script 2016 hobject
It's puzzling how your code worked. Even before the graphics change, the |Tag| property required a char array and as far as a re...

10 years ago | 0

Answered
Input Arguments for Callback Function in a listener
Yes, I think matlab's doc does a poor job of explaining the arguments that get passed to a callback. Thankfully, they use the sa...

10 years ago | 0

Answered
how to find duplicates in a structure
Numbered variables (or fields) is usually an indication that the thing would be much better stored as a matrix or cell array. In...

10 years ago | 0

| accepted

Answered
Help with a nested loop
The loops are not needed. function out = EMA_location_compare(OutputVariable, Dist, xCartCoor, yCartCoor) validatea...

10 years ago | 1

| accepted

Answered
How to change the 7th least significant of a binary code?
There are many ways: for idx = 1:numel(yourcellarray) yourcellarray{idx}(7) = '1'; end &nbsp; cellarrayasc...

10 years ago | 2

Answered
Hey I'm trying to assemble this 20by20 stiffness matrix but I'm having trouble with my loop and very inexperienced in matlab.How do I write this to save time?
matrixsize = 20; %or however many elements it's supposed to be k = 7; %or whatever value it's supposed to be m = toe...

10 years ago | 0

Answered
How to find elements in an array based on a search from another array.
ismember(a, b)

10 years ago | 0

| accepted

Answered
How can I pull data from Access without hard coding the table name?
Nearly got it right: exec(conn, sprintf('SELECT * from %s', tablename))

10 years ago | 0

| accepted

Answered
Create submatrix from large array based on string in column
filteredcellarray = yourcellarray(strcmp(yourcellarray(:, 9), 'Ozone'), :)

10 years ago | 0

| accepted

Answered
How to form final template for entire database?
Well, you certainly like to overcomplicate the code and overuse cell arrays. Step 2: |p| is simply the sum of 1s in each row ...

10 years ago | 0

Answered
I want to know find height and width of binary image and angle
Your question is really not clear, at a guess you want the height width and general angle of the white figure in your image. All...

10 years ago | 0

Answered
Error: Undefined function <func_name> for input arguments of type 'double'.
I suspect the problem is |str2func| not seeing the local function. That's the problem with using strings to store code, the JIT ...

10 years ago | 1

| accepted

Answered
How can i change rgb picture to red or green or blue
_"rgb picutre to (r,0,0)pixels"_: yourimage(:, :, [2 3]) = 0;

10 years ago | 0

Answered
Create subsets of data within a timetable
As you've discovered creating six individually named timetables is not a good idea. As a rule, as soon as you start numbering va...

10 years ago | 1

| accepted

Answered
how to use strtrim in loop
<https://www.mathworks.com/help/matlab/ref/strtrim.html |strtrim|> removes surrounding spaces whereas it looks like you want spa...

10 years ago | 1

Answered
left outerjoin without changing initial order in the output
The problem is your definition of the order of numbers is not the mathematical standard one. Matlab does not let you redefine th...

10 years ago | 1

| accepted

Answered
Data exchange via COM interface
Without the documentation of the COM interface, there's not much we can do to help. I have seen cases where matlab does not want...

10 years ago | 0

| accepted

Answered
How can I use four listeners and plot them on four different axes in a GUI?
I can't see in your code where you created the 4 axis. In any case, all your event listeners do is updating the points of the 4 ...

10 years ago | 1

| accepted

Answered
base64decode not found
Is it really the error message you get (and not _"undefined function or variable 'base64decode'"_)? There is no base64decode ...

10 years ago | 0

Answered
Fraction of a day to HH:MM:SS
This would work: inputdate = '17037.46688591'; jday = inputdate(1:5); date = datetime(jday, 'InputFormat', 'yyDDD') +...

10 years ago | 2

| accepted

Answered
regexprep appending part of the replaced string
You would be better off using |strrep| instead of |regexprep| since your match expression is *not* a regular expression. Note th...

10 years ago | 0

| accepted

Load more