Réponse apportée
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,...

plus de 8 ans il y a | 0

Réponse apportée
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

plus de 8 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 8 ans il y a | 0

Réponse apportée
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)...

plus de 8 ans il y a | 0

Réponse apportée
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).' ...

plus de 8 ans il y a | 0

Réponse apportée
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 ...

plus de 8 ans il y a | 0

Réponse apportée
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...

plus de 8 ans il y a | 1

| A accepté

Réponse apportée
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...

plus de 8 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 8 ans il y a | 0

Réponse apportée
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 ...

plus de 8 ans il y a | 0

| A accepté

Réponse apportée
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 = ...

plus de 8 ans il y a | 2

| A accepté

Réponse apportée
Randomly select an element
use randsample <https://www.mathworks.com/help/stats/randsample.html> randsample(A,1)

plus de 8 ans il y a | 1

| A accepté

Réponse apportée
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...

plus de 8 ans il y a | 0

| A accepté

Réponse apportée
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 = ...

plus de 8 ans il y a | 1

Réponse apportée
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...

plus de 8 ans il y a | 1

Réponse apportée
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;...

plus de 8 ans il y a | 3

Réponse apportée
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,:));...

plus de 8 ans il y a | 1

Réponse apportée
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...

plus de 8 ans il y a | 3

Réponse apportée
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> ...

plus de 8 ans il y a | 2

| A accepté

Réponse apportée
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');

plus de 8 ans il y a | 0

Réponse apportée
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...

plus de 8 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 8 ans il y a | 0

Réponse apportée
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...

plus de 8 ans il y a | 1

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

plus de 8 ans il y a | 1

| A accepté

Réponse apportée
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 &&...

plus de 8 ans il y a | 0

| A accepté

Réponse apportée
.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...

plus de 8 ans il y a | 1

| A accepté

Réponse apportée
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...

plus de 8 ans il y a | 0

| A accepté

Réponse apportée
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}...

plus de 8 ans il y a | 0

Réponse apportée
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,...

plus de 8 ans il y a | 1

Réponse apportée
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 +...

plus de 8 ans il y a | 0

| A accepté

Charger plus