Answered
Saving a new table for every loop iteration
Don't do that. Dynamic variable creation is a bad idea and totally unnecessary. <https://www.mathworks.com/matlabcentral/answ...

6 years ago | 0

| accepted

Answered
How to check monotonity of a vector?
use diff <https://www.mathworks.com/help/matlab/ref/diff.html> along with all maybe a = 1:10; isIncreasing = all(dif...

6 years ago | 3

| accepted

Answered
How to circular shift a matrix for every 1 to 6 elements until its end?
I'm only guessing. If you want to do circshifts for blocks of columns, use mat2cell first, do the shifting and convert it back u...

6 years ago | 0

| accepted

Answered
How do you check if all the values in a vector are in another vector as many or more times?
I'd recommend using intersect since you want to handle repeating elements as well. For example, a=[1 1 3 4 4]; b=[3 3 4 7]...

6 years ago | 0

Answered
How to plot more than 1 curves in one graph.
if they are in columns of excel, read it as a matrix (for a all-numeric matrix), data = xlsread(filename); now let's say ...

6 years ago | 0

Answered
If i have a graph that levels off, how can i find the first x value this occurs at, on matlab?
It depends on how you've stored your data. Let's you have them in a matrix, data = [(1:10)' zeros(10,1)]; data(5,2) = 10; ...

6 years ago | 0

Answered
How to accept only numbers in this case?
use uieditfield <https://www.mathworks.com/help/matlab/ref/uieditfield.html> fig = uifigure; edt = uieditfield(fig,'num...

6 years ago | 1

Answered
How can i specify which subplot that i want to plot on it?
use axis handles, ax1 = subplot(2,1,1); something ax2 = subplot(2,1,2); something now again go back to ax1 ...

6 years ago | 2

| accepted

Answered
how i do loop over column?
If you want to do time-based calculation with your data, for example, weekly average or something I'd highly recommend using tim...

6 years ago | 0

| accepted

Answered
Inefficient code - simple counter
I suppose your condition is something like checking the range of the specific element. Depending on what range they are in you w...

6 years ago | 0

| accepted

Answered
two for Nested Loops
An example with timetable, *EDITED* %import data data = readtable('actual data.txt'); %create a proper datetime co...

6 years ago | 0

Answered
Generic index select, without loops
V1=[45 23 26 17 29]; V2=[3 5] ; V3 = V1(~ismember(V1,V1(V2))) V3 = 45 23 17

6 years ago | 0

| accepted

Answered
How do I extract data from multiple matrices with double variable?
Oh no! Don't do that. When you can store all your data in *one* variable, why would you prefer a complex way (creating multiple ...

6 years ago | 1

| accepted

Answered
Split array into sub arrays
Or use mat2cell, res = mat2cell([x y z].',3,diff([0 find(data) numel(data)])) you get the result in a cell array, each ce...

6 years ago | 1

| accepted

Answered
Multiplying matrices and vectors in loop
_they are all 3 x 3..._ No, they are not. Check the output for the following size(CA) size(CF) and the other matrice...

6 years ago | 0

| accepted

Answered
How to check if several variables are not equal ?
use isequal. It checks all the inputs are equal and if yes, it returns 1. Use |~| if you want only the else case. if isequal...

6 years ago | 0

Answered
How can I set the numbers of decimals (precision) of the solution of fminunc?
Use the StepTolerance option, options = optimoptions(@fminunc,'StepTolerance',0.01); <https://www.mathworks.com/help/opti...

6 years ago | 0

Answered
Determine averages for duplicate values
use a table and then varfun with grouping variable as your station name, T = cell2table(C,'v',{'stationName','channelName',r...

6 years ago | 0

| accepted

Answered
Copy of multiple equal size arrays into one big array using loop
Use counter variable on the third dimension if your matrix is 2D already, for example, arr(:,:,counterVar) or a cell arra...

6 years ago | 0

Answered
How to Horizontally concatenate the values of a matrices present inside a cell array using loops?
if C is your cell array, x = cellfun(@(x)reshape(x,size(x,1),[]),C,'uni',0)

6 years ago | 0

| accepted

Answered
proof if value is greatest of a range of Values
Yes, you could do that but I'm unsure if you'd really need a for-loop. If you could explain your real intentions, the actual sol...

6 years ago | 0

Answered
how to combain matrix with vector
Something like this? a = [9 8 7; 6 5 4]; v = [1 2 3 4 5]; sz = size(a); a = [a inf(sz(1),size(v,2)-sz(2));v]

6 years ago | 1

Answered
How to call the rows of a matrix without the for loop
Probably convert them to cell array and then the use of comma-separated lists, B = num2cell(A,2) and then your_progra...

6 years ago | 0

| accepted

Answered
What can I write in a MATLAB function block in Simulink?
_If s is a vector, I will just count the number of negative entries, and then shift the y by this amount_ Shouldn't you be si...

6 years ago | 1

Answered
How to find out mean within a loop?
Store the result from each iteration and then calculate mean outside the loop. Capacitance1 = zeros(1,Number_of_measurements...

6 years ago | 1

| accepted

Answered
for loop only shows value of last iteration.
You're overwriting all your variables inside the loop so you'd only see the result of the last iteration. You'd need to use arra...

6 years ago | 0

Answered
how to extract corresponding file name from recognized index
Your code snippets are quite unclear but if you want to index certain elements from the |dir| output, that's just like indexing ...

6 years ago | 0

| accepted

Answered
why this error occur ??Index exceeds matrix dimensions.
You can easily access those elements just by accessing thier corresponding indices but you should make sure you accessing elemen...

6 years ago | 0

| accepted

Answered
how to duplicate each cell in an array
Something like this maybe, n = 3; array1 = [1,2,5]; array2 = reshape(array1.*ones(n),1,[]) 1 1 1 ...

6 years ago | 0

| accepted

Answered
Subscripted assignment dimension mismatch.
|imread| returns a 3D matrix. If you want to read multiple images and store them in one matrix, use a 4D matrix, for k = 1:3...

6 years ago | 0

| accepted

Load more