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

oltre 3 anni fa | 0

| accettato

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

oltre 3 anni fa | 0

| accettato

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

oltre 3 anni fa | 1

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

oltre 3 anni fa | 0

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

oltre 3 anni fa | 0

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

oltre 3 anni fa | 0

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

oltre 3 anni fa | 0

| accettato

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

oltre 3 anni fa | 0

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

oltre 3 anni fa | 0

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

oltre 3 anni fa | 0

| accettato

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

oltre 3 anni fa | 1

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

oltre 3 anni fa | 0

| accettato

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

oltre 3 anni fa | 0

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

oltre 3 anni fa | 0

| accettato

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

oltre 3 anni fa | 0

| accettato

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

oltre 3 anni fa | 1

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

oltre 3 anni fa | 1

| accettato

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

oltre 3 anni fa | 0

| accettato

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

oltre 3 anni fa | 0

| accettato

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

oltre 3 anni fa | 0

| accettato

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

oltre 3 anni fa | 1

| accettato

Risposto
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)

oltre 3 anni fa | 0

| accettato

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

oltre 3 anni fa | 0

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

oltre 3 anni fa | 1

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

oltre 3 anni fa | 0

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

oltre 3 anni fa | 1

| accettato

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

oltre 3 anni fa | 0

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

oltre 3 anni fa | 0

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

oltre 3 anni fa | 1

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

oltre 3 anni fa | 0

| accettato

Carica altro