Réponse apportée
change the scale of colorbar
you can use the caxis command, simply add caxis( [0 0.02]) below the colorbar command. figure surf(rand(10,10)) c = colorbar;...

environ 2 ans il y a | 0

| A accepté

Réponse apportée
What is the syntax for iterating over given coordinates, using a For loop?
You can do this in the following way: X1 = [10 12 14 23 24 23 18 16 12 10]; Y1 = [20 20 18 15 8 7 8 6 12 20]; for i = 1:num...

environ 2 ans il y a | 0

| A accepté

Réponse apportée
How to convert strings in a table to numbers?
An easy method would be to use the third output of the unique command. This will work directly on strings and will give the core...

environ 2 ans il y a | 1

Réponse apportée
Extract value from every struct
You can acces the data in the struct by placing a point after the variable name of the struct, follewed by the fieldname you wan...

environ 2 ans il y a | 0

Réponse apportée
text file to be in the folder
No need for the save command, first create the folder (or check that it exists) and then you can write the file directly into th...

environ 2 ans il y a | 0

Réponse apportée
How to create a triangular shape using following Code in MATLAB
Based on the scatter mentioned in you question I combined the two loops and the resulting points in a single grid. This allows t...

environ 2 ans il y a | 0

Réponse apportée
Running my code in a loop to make it more efficient
You can create a for loop, and just save the variables directly into matrices, see below for an example with 10 iterations and 7...

environ 2 ans il y a | 0

| A accepté

Réponse apportée
Count impulses into sequence of impulses and segments of sequences of impulses from signal
If the rectangles were drawn using matlab, then you know the start and stop time. Thus, if this works for the total number of p...

environ 2 ans il y a | 0

Réponse apportée
Rewrite the format of a string
In the for loop, 'x' starts from 1, hence you will overwrite the data in iwant for each new file. One method to resolve this is...

environ 2 ans il y a | 0

Réponse apportée
how to draw Bipartite Matrices and Projection Matrices.
such figures can be generated with the spy command. See below for an attempt to produce the top left figure using a bit of rando...

environ 2 ans il y a | 0

| A accepté

Réponse apportée
Array indices must be positive integers or logical values.
The following part of you code can produce an error: i starts at 1, hence you are trying to acces t(0) which is not possible. In...

environ 2 ans il y a | 1

Réponse apportée
Average of multiple matrices
This depends how your images are stored in memory, if they are stored in a 3D array you can use the mean function % generate 3...

environ 2 ans il y a | 0

| A accepté

Réponse apportée
Vector question help?
% this step creates a vector with 25 normal distributed random values MyVector = randn( 1,25 ) % if you want to round these va...

environ 2 ans il y a | 0

Réponse apportée
Plot an equation in time span T=[0,t]
You need to create a vector, below you can see a method using the "linspace" function. This creates a vector between 0 and t wit...

environ 2 ans il y a | 0

| A accepté

Réponse apportée
how to create random vector?
RandomDouble = rand(25,1) % i.e. pick 25 random values between 0 and 1 RandomIntegers = randi(1000,25,1) % i.e. pick 25 integer...

environ 2 ans il y a | 0

| A accepté

Réponse apportée
If else -statement doesn't work
The easiest method will be to first create a zero array, and then fill in the values according to the required logic: % intiali...

environ 2 ans il y a | 1

Réponse apportée
calculate the volume obtained by rotating a function around the X-axis
Hello, since at first glance there are no internal voids you can use the convex hull function to determine the volume numericall...

environ 2 ans il y a | 1

| A accepté

Réponse apportée
To concatenate single column of a cell array
You can use cell2mat to do this, see below for an example % generate cell array with random data C = cell( 3072 , 2); C = cel...

environ 2 ans il y a | 0

| A accepté

Réponse apportée
How to use Matlab to solve equation like Mathcad
Use the symboic toolbox to determine the equations, see below. syms fp1 fp2 fz1 fz2 fc boost real eqn = boost == ( atan(fc/fz1...

environ 2 ans il y a | 0

| A accepté

Réponse apportée
Error in writing the output to excel file
As indicated in the error message you need to convert the sym into a double or a string, see below for both options syms m1 m2 ...

environ 2 ans il y a | 0

| A accepté

Réponse apportée
Trying to find the corresponding value of a matrix with an input?
see below for the interpolation fig = openfig('VelocityAgainstRodHeight500Hz.fig'); axObjs = fig.Children; dataObjs = axObjs....

environ 2 ans il y a | 1

| A accepté

Réponse apportée
How introduce a delay of one second in MATLAB?
you can use the "pause" function, this will pause matlab for the given amount of time pause(1)

environ 2 ans il y a | 0

| A accepté

Réponse apportée
create a sparse multidimensional matrix
you can either fill it in directly or use blkdiag to create this shape: % direct method % on row 3 7 and 11, column 1 2 3 resp...

environ 2 ans il y a | 0

Réponse apportée
How to define if a point is inside or outside a 3D pyramidal area?
Hi, asuming you want to use as many standard matlab functions, the easiest method i can think is by constructing two terahedrond...

environ 2 ans il y a | 1

Réponse apportée
How can I create a quadratic matrix with variables?
you do not need to use .' in this case, only use the transpose operator: syms q1dot q2dot q3dot q4dot q5dot real qdot= [q1dot...

environ 2 ans il y a | 0

Réponse apportée
Frequency words for each labels
Edit to make so that the code works with the latter added example data... % read the file data = readtable("dati_classificat...

environ 2 ans il y a | 1

| A accepté

Réponse apportée
Order Matlab not to continue until the external run is completed
Asuming you are using windows. You can can just add the [~,~] as output to the system command, this way matlab will wait unti...

environ 2 ans il y a | 0

Réponse apportée
I want to Access value by using its key , the login should to be like if user enter key1 it should match with key1 keyword from excel sheet and give value_1 as output.
Hi, you can compare the strings of the key with the user input, and then use that index to retrieve the value: UserInput = "key...

plus de 2 ans il y a | 0

Réponse apportée
Read the column 2 and 11 from 45 csv files in 45 subfolder hence plot them.
Distance(i) = table2array(data(:,2)); Here you are trying to store an entire array into a single placehoder. Unless data(:,2)...

plus de 2 ans il y a | 1

Réponse apportée
How to mark the maximum of a surf plot
I'm guessing you switched maxa and maxb. Note that the columns are plotted on the x axis and the rows on the y axis. alpha=50; ...

plus de 2 ans il y a | 0

| A accepté

Charger plus