Answered
How to plot a set of vectors dependent on a variable?
Simply create a vector for |x|, x = 1:100; now calculate your result, say |y|, y = [x.^2; 3*x]; in the above line,...

8 years ago | 0

Answered
How to change a letter to italic font on x-label on graph?
Set the interpreter to tex and use |\it| xlabel('$\it W_b$','Interpreter','tex') %EDITED

8 years ago | 0

| accepted

Answered
Read data couples from txt file
Does your file also have the double quotation mark and \t,\r as you have written? If not, something as simple as, data = dlm...

8 years ago | 0

Answered
Replace specific values in a matrix with zeros
Try this, [r c] = size(A); C = zeros(r,c); indx = bsxfun(@le,repmat((1:r).',1,c),repmat(B,r,1)) %find indicies C(indx)...

8 years ago | 0

Answered
selection of data from matrix
One easy alternative is to shuffle the row of your matrix first and then extract them from top to bottom, data = [(1:100).' ...

8 years ago | 0

Answered
My if statement with multiple conditions gives wrong values
Store the output of every iteration of triangles in a cell array. For example, traingles = cell(desiredSize); %pre-allocate ...

8 years ago | 0

Answered
How can I control the format of the tick label numbers when using a log YScale with a large range?
You should use |yticks| and |yticklabels| if you explicitly want to control what is to be displayed. <https://www.mathworks.c...

8 years ago | 1

| accepted

Answered
remove not corresponding values in matrix
first create some dummy data, mat1 = [1:10;rand(1,10)].'; % matrix with continuous values on column 1 mat2 = [randperm(2...

8 years ago | 0

| accepted

Answered
help with function to solve mean
First you need to learn to create an array. You could either use concatenation operator - [] or the semicolon operator, <http...

8 years ago | 0

Answered
how extract the data from 4D matrix and plot ?
What do you mean by _it does not work_?? Are you getting an error? Are you not getting the expected result? See this example ...

8 years ago | 0

| accepted

Answered
How to create a 2D diagonal matrix from a 3D matrix with a generic dimension? It could be with a loop structure.
Use a cell array and then something like, c = arrayfun(@(x) k(:,:,x),1:n,'uni',0) u = blkdiag(c{:}) u = ...

8 years ago | 2

| accepted

Answered
Randomly select an element
use randsample <https://www.mathworks.com/help/stats/randsample.html> randsample(A,1)

8 years ago | 1

| accepted

Answered
Use a for loop inside a vector
I'm not sure what you want, but probably something like this (no need for loop, just one line like below), curve = recktangl...

8 years ago | 0

| accepted

Answered
How to subtract Mean from Matrix along columns
Just the same way, |A-A_mean|. Here's an example with 5 columns, >>A = reshape(1:25,5,5) %dummydata A = ...

8 years ago | 1

Answered
How to calculate moving average
If you have 2016b or later, use movmean, <https://www.mathworks.com/help/matlab/ref/movmean.html> mean_arr = movmean(your...

8 years ago | 1

Answered
Why doesn't my script work. I try to create a vector in dependecy of variable without a loop. I'm not sure how i have to define the vector before the if cases
No need for a loop, use logical indexing. Here's a better way to write that, indx = z<2000; v(indx) = 1500+z(indx)*g_1;...

8 years ago | 3

Answered
How to extract the first row and first column of an array of matrix?
Use squeeze, <https://www.mathworks.com/help/matlab/ref/squeeze.html> all_first_elements = squeeze(your_matrix(1,1,:));...

8 years ago | 1

Answered
else if statements on a table
You do not need if-else to filter data when you use a table. It would have been easier had you attached some sample data, aynway...

8 years ago | 3

Answered
Split the decimal numbers of Pi and scan into a table
If you have access to Symbolic Math Toolbox things will be lot easier <https://www.mathworks.com/help/symbolic/digits.html> ...

8 years ago | 2

| accepted

Answered
Problems With readtable. Convert string data in datetime with milissecond precision.
Try this, data = readtable('Teste2.csv'); data.Time = datetime(datevec(data.Time),'Format','HH:mm:ss.SSS');

8 years ago | 0

Answered
shifting a timeseries without lagmatrix
Something like this maybe, %create some data C = {'06-Jan-1911 00:00:00' 425 '07-Jan-1911 00:00:00' 345 '08-Jan-19...

8 years ago | 0

| accepted

Answered
Hi, i want to plot simple function, Can someone tell me how to plot it
t = 0:0.01:2; c1 = [10;20;30]; c2 = [5;15;25]; now you have t and different set of c's. Then pre-allocate y1 and y2 a...

8 years ago | 0

Answered
Using matrixes in functions
I'm not sure what you're trying to do with your if else condition in your function, but if you want assign torque1 and torque2 t...

8 years ago | 1

Answered
Convert a Matrix column to date
Try something like this, dt = [20110130; 20110131; 20110201]; %your column d = datetime(num2str(dt),'InputFormat','yyyyM...

8 years ago | 1

| accepted

Answered
if i have a nested while loop and the second condition of the loop is true but first is wrong how to make it go back again to the first while loop?
You don't need two loops, n = 0; x=input('enter correct number of k'); while n<3 n=numel(x); if n>=3 &&...

8 years ago | 0

| accepted

Answered
.mat to csv
Well, your |lbp| cell array has a vector in each cell! Anyway, I'd prefer to create a table and then use |writetable| function l...

8 years ago | 1

| accepted

Answered
How can I omit a submatrix by its name
Here's a simple example. first define your array, A = [1 2 3;4 5 6;7 8 9]; now let's say you want to exclude every row...

8 years ago | 0

| accepted

Answered
How can I create a new column counting the number of rows of a table?
In MATLAB indexing is inherent, be it array or tables. If you have a table like, dummy = {'call',366;'free',216;'txt',163}...

8 years ago | 0

Answered
Create a cell from a matrix
If you want to have each row in separate cells, mat1=[1,2,3,4,5;0,0,1,0,1]; C1 = arrayfun(@(x) {mat1(x,:)},1:size(mat1,...

8 years ago | 1

Answered
How to set colorbar seperately for subplot?
Try using handles, that way you have control over which colorbar you're accessing, [X,Y] = meshgrid(-5:.5:5); Z = X.^2 +...

8 years ago | 0

| accepted

Load more