A résolu

Find the sum of all the numbers of the input vector
Find the sum of all the numbers of the input vector x. Examples: Input x = [1 2 3 5] Output y is 11 Input x ...

plus d'un an il y a

Réponse apportée
finding the distance between two points
To identify the distances between the nodes of a segment you first need to identify the nodes that make up that segment. Once yo...

plus d'un an il y a | 0

Réponse apportée
How to calculate repeated calculation using LOOP?
Note that you can add data (e.g. a .mat file) to your question using the paperclip symbol. Without it is is difficult to validat...

plus d'un an il y a | 0

| A accepté

Réponse apportée
Creating rainbow coloured plots in 3d
This can be done with the patch command, see below for a demonstration numPoints = 100; % create a random line Grid = zeros...

plus d'un an il y a | 0

Réponse apportée
What are the obs values in this spherical surface equation?
I added some comments in the code below. % define the center of the sphere (i.e. the location of the centroid of the sphere) c...

plus d'un an il y a | 3

| A accepté

Réponse apportée
How to automatically run all matlab files in a folder
something like this should work folder = 'YourFolder'; mfiles = dir(fullfile(folder, '*.m')); % loop over the files for k ...

plus d'un an il y a | 1

Réponse apportée
How do I plot the relative error for each iteration vs. iteration number?
Hey, you need to save the value in order to plot it. I added an extra variable (ea_plot) to achieve this, see below. A = [4 1 2...

plus d'un an il y a | 1

Réponse apportée
Periodically fill scatter3
you can use the 'hold on' command to preserve the figure and add information to it, see below for an example % create an empty ...

plus d'un an il y a | 0

| A accepté

Réponse apportée
How do I create a matrix from another matrix excluding values?
Hi, see below for a two step procedure to do this. Example = [ 5 0 2022 820 7 1 820; 5 1 2022 813 4 9 805; 5 2 2022...

plus d'un an il y a | 0

| A accepté

Réponse apportée
For loop only working/filling cell array for half of data
One issue was the reuse of the variable name "x" directly after entering the loop, you overwrite your orinal data by removing el...

plus d'un an il y a | 0

| A accepté

Réponse apportée
How to pull data from a table from a file and use as a string or cell.
Hi Terry, See below for one example on how to do this. This idea is to first use some logic operators to determine if the code ...

plus d'un an il y a | 0

| A accepté

Réponse apportée
Why do i keep on getting error 'Not enough input arguments' on calling the function?
See below for the modified version. There were two issues: You need to call the function with two inputs: the array and the in...

plus d'un an il y a | 0

| A accepté

Réponse apportée
for loop skipping an iteration
I would use a separate variable for the for-loop. See below with the adjusmtents. n = [10 100 1000]; for i = 1:numel(n) ...

plus d'un an il y a | 0

| A accepté

Réponse apportée
How to do vector loop equation?
The syntax for the solve function works a bit different, see below for a demonstration. Notice that if you have a set of two eq...

plus d'un an il y a | 1

Réponse apportée
How to combine 2 function handles of different variables?
You need to add the input parameter in order to evaluate the functions. See below for demonstration using some random inputs. Y...

plus d'un an il y a | 1

| A accepté

Réponse apportée
Extracting survey data from individual files and combining
I used the text files from your comment to update my answer, to (hopfully) better fit it to what you are looking for. I was not...

plus d'un an il y a | 0

| A accepté

Réponse apportée
fprintf two 3x1 matrix's w/ text
Make sure that you add an end of line character "\n" to the end of the fprintf statement, otherwise evrtything will be printed o...

plus d'un an il y a | 1

| A accepté

Réponse apportée
Change file from equipment to .txt files
This would do the trick, see below for some comments. % Enter the directory to search directory = uigetdir(); % List all item...

plus d'un an il y a | 0

| A accepté

Réponse apportée
I tried plot a 3d animated but it doesn't work.
I think you want to use scatter3 and not plot3. See below for a demonstration, i commented some line to run it in the browser (w...

plus d'un an il y a | 0

| A accepté

Réponse apportée
How di I make concise multiple parameter calls?
One way to do this is by storing the data (or params as you call them) in a cell array, see below for an example. MyString = ['...

plus d'un an il y a | 0

| A accepté

Réponse apportée
Index in position 1 exceeds array bounds (must not exceed 7).
I indicated in your script where the issue lies, in short: P is a 7x2 matrix. when kk == length(k), it means that k(kk) = 7 ...

plus d'un an il y a | 0

| A accepté

Réponse apportée
3D point plotting
you can use the plot3 function to plot a 3D line, see below for a demonstration. L1 = 26; R1 = [16 ;17 ; 19 ;25 ;26 ; 27 ; ...

plus d'un an il y a | 0

| A accepté

Réponse apportée
How do you change the asterisks in the first string to the characters in the same positions in the second string?
See below for one method. string1 = 'v**de***t'; string2 = 'eolehmors'; % find location of the asterisks idx = string1 == ...

plus d'un an il y a | 0

| A accepté

Réponse apportée
How to display only few values in a plot rather than for whole points in a big array?
See below for a demonstration, i had to assume some parameters. However the plotting princaple remains the same. % these parame...

plus d'un an il y a | 0

| A accepté

Réponse apportée
Join two table variables into one. == does not works of table type
I think one of the issues is the nan in the data, the result of nan == nan is something for philosophers :) Anyhow, see below f...

plus d'un an il y a | 0

| A accepté

Réponse apportée
How to get all positive values in following code
Im modified the code a bit, see below for the adjustments and some coments in the code. I stored the T values along with the i ...

plus d'un an il y a | 0

Réponse apportée
displaying images in random order using 'imread' function
one method could be the following: % number of images numImg = 4; % random permutation of the integers 1:numImg imgIdx = ran...

plus d'un an il y a | 0

| A accepté

Réponse apportée
formula for changing the base of a logarithm is: loga(N) = (logb(N))/(logb(a)) (a) Use MATLAB's function log (x) to calculate log4(0.085)
You can create a function handle to eval the desired base: log4_fun = @(x) log(x) / log(4) log4_fun(0.85)

plus d'un an il y a | 0

Réponse apportée
Efficient submatrix product computation
Do note that a for loop can be very efficient. I'm not sure the single line methods will always be faster. Below you can find o...

plus d'un an il y a | 1

| A accepté

Réponse apportée
Adding parameter to file name string when saving a figure using savefig or figsave
Do you mean savefig? See below fo a method to create the filename as you indicate and a demo to save and open the figure. CHANN...

plus d'un an il y a | 0