A répondu
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...

plus de 6 ans il y a | 0

| A accepté

A répondu
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...

plus de 6 ans il y a | 3

| A accepté

A répondu
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...

plus de 6 ans il y a | 0

| A accepté

A répondu
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]...

plus de 6 ans il y a | 0

A répondu
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 ...

plus de 6 ans il y a | 0

A répondu
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; ...

plus de 6 ans il y a | 0

A répondu
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...

plus de 6 ans il y a | 1

A répondu
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 ...

plus de 6 ans il y a | 2

| A accepté

A répondu
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...

plus de 6 ans il y a | 0

| A accepté

A répondu
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...

plus de 6 ans il y a | 0

| A accepté

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

plus de 6 ans il y a | 0

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

plus de 6 ans il y a | 0

| A accepté

A répondu
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 ...

plus de 6 ans il y a | 1

| A accepté

A répondu
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...

plus de 6 ans il y a | 1

| A accepté

A répondu
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...

plus de 6 ans il y a | 0

| A accepté

A répondu
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...

plus de 6 ans il y a | 0

A répondu
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...

plus de 6 ans il y a | 0

A répondu
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...

plus de 6 ans il y a | 0

| A accepté

A répondu
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...

plus de 6 ans il y a | 0

A répondu
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)

plus de 6 ans il y a | 0

| A accepté

A répondu
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...

plus de 6 ans il y a | 0

A répondu
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]

plus de 6 ans il y a | 1

A répondu
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...

plus de 6 ans il y a | 0

| A accepté

A répondu
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...

plus de 6 ans il y a | 1

A répondu
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...

plus de 6 ans il y a | 1

| A accepté

A répondu
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...

plus de 6 ans il y a | 0

A répondu
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 ...

plus de 6 ans il y a | 0

| A accepté

A répondu
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...

plus de 6 ans il y a | 0

| A accepté

A répondu
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 ...

plus de 6 ans il y a | 0

| A accepté

A répondu
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...

plus de 6 ans il y a | 0

| A accepté

Charger plus