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

alrededor de 8 años hace | 0

Respondida
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

alrededor de 8 años hace | 0

| aceptada

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

alrededor de 8 años hace | 0

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

alrededor de 8 años hace | 0

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

alrededor de 8 años hace | 0

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

alrededor de 8 años hace | 0

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

alrededor de 8 años hace | 1

| aceptada

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

alrededor de 8 años hace | 0

| aceptada

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

alrededor de 8 años hace | 0

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

alrededor de 8 años hace | 0

| aceptada

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

alrededor de 8 años hace | 2

| aceptada

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

alrededor de 8 años hace | 1

| aceptada

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

alrededor de 8 años hace | 0

| aceptada

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

alrededor de 8 años hace | 1

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

alrededor de 8 años hace | 1

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

alrededor de 8 años hace | 3

Respondida
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,:));...

alrededor de 8 años hace | 1

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

alrededor de 8 años hace | 3

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

alrededor de 8 años hace | 2

| aceptada

Respondida
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');

alrededor de 8 años hace | 0

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

alrededor de 8 años hace | 0

| aceptada

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

alrededor de 8 años hace | 0

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

alrededor de 8 años hace | 1

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

alrededor de 8 años hace | 1

| aceptada

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

alrededor de 8 años hace | 0

| aceptada

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

alrededor de 8 años hace | 1

| aceptada

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

alrededor de 8 años hace | 0

| aceptada

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

alrededor de 8 años hace | 0

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

alrededor de 8 años hace | 1

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

alrededor de 8 años hace | 0

| aceptada

Cargar más