Community Profile

# Stephen23

Attivo dal 2014

Suspensa Vix Via Fit

All

#### Content Feed

Visto da

Risposto
I want to export data to txt file in Loop
P = 'absolute or relative path to where the files are saved'; S = dir(fullfile(P,'*.txt')); for k = 1:numel(S) F = fullfi...

circa 11 ore fa | 0

Risposto
i am tring to input different z values to get different B using matrix manipulation. just having trouble using for loop
Note that I replaced the INV()* with the recommended MLDIVIDE: https://www.mathworks.com/help/matlab/ref/inv.html#bu8tv8c-6 An...

circa 11 ore fa | 0

| accettato

Risposto
How to break data in to groups using while loop?
M = [1 50 60 70 50 40 2 NaN 10 20 10 10 3 NaN 20 NaN NaN NaN 1 NaN 60 30 40 50 2 10 20 10 20 NaN 1 30 2...

1 giorno fa | 0

Risposto
How can i calculate the length of curve?
A very simple approach is to download John D'Errico's excellent ARCLENGTH function: https://www.mathworks.com/matlabcentral/fil...

2 giorni fa | 0

Risposto
How to measure elapsed time in hh:mm:ss?
You can do this with SECONDS(), but then it requires two lines. Here is a simple solution on one line: tic .. dur = duration(...

2 giorni fa | 0

Risposto
Str2double gives NaN

2 giorni fa | 1

| accettato

Risposto
Why do I receive the error "Undefined function 'times' for input arguments of type 'matlab.graphics.chart.primitive.Line'"?
The basic problem is that you have re-used the variable name p. You think that p is some value from the start of your code, but ...

2 giorni fa | 0

| accettato

Risposto
How to find number of bit change between binary numbers?
A = ['110'; '101'; '011'; '111'; '100'; '001'; '010'] B = sum(diff(A,1,1)~=0,2)

3 giorni fa | 1

| accettato

Risposto
How to loop function for all timesteps in one text file
T = fileread('atomlocation.txt'); C = regexp(T,'(^\S+\s+\S+\s+\S+\s*\n)+','lineanchors','match') N = numel(C); fprintf('%d bl...

4 giorni fa | 0

| accettato

Risposto
How to create a 3D Matrix?
"While in python this matrix is of 3*2*5," Not really, it is actually just a whole lot of nested 1D lists. In some languages th...

5 giorni fa | 0

Risposto
This statement is not inside any function. (It follows the END that terminates the definition of the function "mixing_tank".)
The function definition needs to come after all of the other code. See: https://www.mathworks.com/help/matlab/matlab_prog/local...

6 giorni fa | 0

Risposto
Get special variable out of every struct in workspace
"Is there any way to extract the "values" out of these 2 structs for each variable which is loaded into the workspace?" Yes, bu...

6 giorni fa | 1

Risposto
How to load all .mat file in the current directory and save them as .wav file?
P = 'C:\Users\Desktop\BE'; S = dir(fullfile(P,'*.mat')); for k = 1:numel(S) F = fullfile(S(k).folder,S(k).name); D =...

6 giorni fa | 1

| accettato

Risposto
How do I add rows to a table in a for loop?
"... it keeps producing the tables I want, but not in the order I want, and I don't know how to fix this." My guess (in lieu of...

7 giorni fa | 0

Risposto
identifying entry elements in rows of logical matrix
A = [1,1,1;0,1,1;0,0,0;0,1,0] B = A .* (cumsum(A,2)==1) % replace .* with & to get a logical output

7 giorni fa | 3

| accettato

Risposto
How to perform function whos output is a struct in a loop?
Assuming identical fieldnames, the simplest and most robust solution is to concatenate the structure after the loop: N = numel(...

7 giorni fa | 0

Risposto
Deleting fields of a particular dimension in a structure
As I wrote in several of your earlier questions, this task would be much easier if your data were better designed: https://www....

7 giorni fa | 0

Risposto
How can I change timestamp format?
The best solution is to fix the source. Otherwise: C = {'09.02.2022 14:41:56:999';'09.02.2022 14:41:57:1'} D = regexprep(C,{':...

7 giorni fa | 0

| accettato

Risposto
Creating a row vector of combinations?

7 giorni fa | 3

Risposto
Extracting names from first row of index and seeing if they are equal to indexed variable?
You can simplify this by using one loop. Lets first create some fake data: mkdir ./scan1 mkdir ./scan2 mkdir ./scan3 writema...

8 giorni fa | 0

| accettato

Risposto
How to eliminate values after comma, in double value?
A wild guess: V = [0.2,0.2862] W = fix(V*10)/10

8 giorni fa | 1

| accettato

Risposto
How i creat Costomer fscanf?
format long M = readmatrix('sol2.txt', 'Delimiter',{' ','∠'}, 'MultipleDelimsAsOne',true, 'TrimNonNumeric',true)

8 giorni fa | 1

| accettato

Risposto
How to save the Data in different array using Value in 2nd column
Clearly creating lots of separate variables in the workspace would be a very bad approach: https://www.mathworks.com/matlabcent...

8 giorni fa | 0

Risposto
Not enough input arguments (line 2)

8 giorni fa | 1

| accettato

Risposto
Return variable from nested function
Callback functions do not return output arguments**, so your approach will not work. The MATLAB documentation explains approache...

10 giorni fa | 0

| accettato

Risposto
How to convert fields in a struct into an int?
This would be much easier if your data were better designed, exactly as I recommended in your last question (which you have so f...

11 giorni fa | 0

Risposto
How do you iterate over multiple fields in a structure?
One approach is to use FIELDNAMES() and dynamic fieldnames: https://www.mathworks.com/help/matlab/matlab_prog/generate-field-na...

11 giorni fa | 0

| accettato

Risposto
Plotting data from struct array
"I am really not sure how to call plot with the plot vectors being contained in fields/subfields of a struct array." The answer...

12 giorni fa | 1

| accettato

Risposto
Create folders and organize data based on file name.
movefile('*CP-A-01*.*', 'newdir01') movefile('*CP-B-01*.*', 'newdir02')

12 giorni fa | 0

Risposto
Is it possible to create a nested structure with dynamic field names?
"However, this version of dot indexing (right side dynamic naming) is not supported." Lets try it right now: S.A.B.C = pi; S....

12 giorni fa | 1

| accettato