Answered

how to read a table from a CSV file with multiple header

fname = 'MyCSV.csv'; headerlines = 2; CSV_Data = dlmread(fname,',',headerlines,0); % filename, delimiter, row offset, column...

how to read a table from a CSV file with multiple header

fname = 'MyCSV.csv'; headerlines = 2; CSV_Data = dlmread(fname,',',headerlines,0); % filename, delimiter, row offset, column...

1 jour ago | 0

Answered

how to create histogram for each value of a matrix

M=[1,1,2,3; 0,4,2,2; 1,1,1,1]; N = M(:); % make into vector [SortedMat,I] = sort(N); % so...

how to create histogram for each value of a matrix

M=[1,1,2,3; 0,4,2,2; 1,1,1,1]; N = M(:); % make into vector [SortedMat,I] = sort(N); % so...

15 jours ago | 0

Question

Create a 1 x m Structure instead of a 1x1 Structure

Hello, Im tring to create a 1 x m structure instead of a 1x1. When doing the following, it creates a 1x1 struct MySturcture.Fi...

20 jours ago | 3 answers | 0

Question

Combine 2 Cell Matrices into One

Hello, Im trying to combine data from two matrices into one. An example: A = {'A','B','C';'A','B','C'}; B = {'1','1','1';'2',...

22 jours ago | 1 answer | 0

Question

How can you store values in App Designer like you can in GUIDE?

Hello, Im trying to store some variables in App Designer like I can in GUIDE using handles. In GUIDE for example, I could do:...

22 jours ago | 1 answer | 0

Answered

have two columns that are the same size but one of them has NAN on the first and last row, how would i delete those rows for both columns

a = 1:10; b = 1:10; b(1) = NaN; b(end) = NaN; NaN_Vals = find(isnan(b)); a(NaN_Vals) = []; b(NaN_Vals) = [];

have two columns that are the same size but one of them has NAN on the first and last row, how would i delete those rows for both columns

a = 1:10; b = 1:10; b(1) = NaN; b(end) = NaN; NaN_Vals = find(isnan(b)); a(NaN_Vals) = []; b(NaN_Vals) = [];

3 mois ago | 0

| accepted

Answered

How to save multiple figures with subplots as a single .fig file in an for loop

Try this. Pay special attention to the last line. % within the for loop figs(1,1)=figure; subplot(2,2,1) cdfplot(baseavgpric...

How to save multiple figures with subplots as a single .fig file in an for loop

Try this. Pay special attention to the last line. % within the for loop figs(1,1)=figure; subplot(2,2,1) cdfplot(baseavgpric...

3 mois ago | 0

Answered

Deleting rows of a table using for loops if consecutive terms in the first column are the same

Please - next time use the code format. It makes this easier to look at. You're deleting an active part of the table, and changi...

Deleting rows of a table using for loops if consecutive terms in the first column are the same

Please - next time use the code format. It makes this easier to look at. You're deleting an active part of the table, and changi...

3 mois ago | 0

Answered

How do I define and use a standard range written by variable

N = 1; RangedValues = [690*N:1200*9]; % set your range, assuming your values are always 690 and 1200 * N Num2Check = 1459; % ...

How do I define and use a standard range written by variable

N = 1; RangedValues = [690*N:1200*9]; % set your range, assuming your values are always 690 and 1200 * N Num2Check = 1459; % ...

4 mois ago | 0

Answered

Move Files from different folder into one.

actually, I like this one better --> rdir MainDirectory = 'C:\Users\80CDGZ1\Documents\Data_EXCOG\EC01\Run1' EndDirectory = 'C:...

Move Files from different folder into one.

actually, I like this one better --> rdir MainDirectory = 'C:\Users\80CDGZ1\Documents\Data_EXCOG\EC01\Run1' EndDirectory = 'C:...

4 mois ago | 0

Answered

Disallow running an App in an older version of ML?

if verLessThan('matlab','9.4') % 2018a = 9.4 disp('Version of Matlab is too old. Please open in MATLAB 2018a or later.') e...

Disallow running an App in an older version of ML?

if verLessThan('matlab','9.4') % 2018a = 9.4 disp('Version of Matlab is too old. Please open in MATLAB 2018a or later.') e...

5 mois ago | 0

Answered

Changing variable name from input string

Chiming in for a 3rd opinion. I have used this in the past succesfully. Depth = [1:100]; prompt = 'What would you like to rena...

Changing variable name from input string

Chiming in for a 3rd opinion. I have used this in the past succesfully. Depth = [1:100]; prompt = 'What would you like to rena...

5 mois ago | 0

Answered

Repeating values on colorbar

Using the example given by Image Analyst, I commented out the Limits lines of code, and it works as intended. Give that a try. ...

Repeating values on colorbar

Using the example given by Image Analyst, I commented out the Limits lines of code, and it works as intended. Give that a try. ...

5 mois ago | 1

Answered

How to select legend in multiple subplot?

Just add the legend line in each "program". (first program) subplot(2,2,1) plot(x,S) hold on subplot(2,2,2) plot(x,E) leg...

How to select legend in multiple subplot?

Just add the legend line in each "program". (first program) subplot(2,2,1) plot(x,S) hold on subplot(2,2,2) plot(x,E) leg...

5 mois ago | 1

Answered

Conditional Statements Between Two Arrays

a = 1:100; b = 1:2:100; c = ismember(a,b); % index of values of array a inside of array b d = a(c); % the values inside of a ...

Conditional Statements Between Two Arrays

a = 1:100; b = 1:2:100; c = ismember(a,b); % index of values of array a inside of array b d = a(c); % the values inside of a ...

6 mois ago | 0

Answered

Saving mat file with prefix over loop

Your Edited .mat file does not exist, so you must create it. Check to see if it exists, if it does, append. If it does not, crea...

Saving mat file with prefix over loop

Your Edited .mat file does not exist, so you must create it. Check to see if it exists, if it does, append. If it does not, crea...

6 mois ago | 0

Answered

Remove consecutive values from vector

a = [1;2;3;7;10;11;12]; x = diff(a); y = vertcat(true,x~=1); % shift index down to grab first number a(y); a = 1 7 ...

Remove consecutive values from vector

a = [1;2;3;7;10;11;12]; x = diff(a); y = vertcat(true,x~=1); % shift index down to grab first number a(y); a = 1 7 ...

6 mois ago | 1

| accepted

Answered

How to plot a maximum value on an existing line graph

Please use the code formatting. A=figure x=[t]; y1=[Ethanol]; y2=[X] % Plot frst graph subplot(1,2,1); plot(x,y1); hold...

How to plot a maximum value on an existing line graph

Please use the code formatting. A=figure x=[t]; y1=[Ethanol]; y2=[X] % Plot frst graph subplot(1,2,1); plot(x,y1); hold...

6 mois ago | 1

Answered

How can i get latex symbols in my figure title with the use of variables?

I dont have all of your variables, but I personally like sprintf. I would strcat your title using strcat to bring it all togethe...

How can i get latex symbols in my figure title with the use of variables?

I dont have all of your variables, but I personally like sprintf. I would strcat your title using strcat to bring it all togethe...

6 mois ago | 0

| accepted

Answered

how can I FIND column of array part from another large array?

MATLAB has a function for this : ismember doc ismember B=[11 22 33 44 55 66 77 99 12 13 16 17]; A=[11 44 33 22 55 66 77 1...

how can I FIND column of array part from another large array?

MATLAB has a function for this : ismember doc ismember B=[11 22 33 44 55 66 77 99 12 13 16 17]; A=[11 44 33 22 55 66 77 1...

6 mois ago | 0

| accepted

Answered

Colour legend for scatter plot

x = [1:50]; % fake x data y = [1:50]; % fake y data z = [1:50]; % "intensity" scatter(x,y,50,z,'filled'); cb = colorbar; % c...

Colour legend for scatter plot

x = [1:50]; % fake x data y = [1:50]; % fake y data z = [1:50]; % "intensity" scatter(x,y,50,z,'filled'); cb = colorbar; % c...

6 mois ago | 1

Answered

Read in Text File as string Array

fileName = '<your full file path here>' % my sample text contains ---> apple, baseball, car, donut, & elephant in single column...

Read in Text File as string Array

fileName = '<your full file path here>' % my sample text contains ---> apple, baseball, car, donut, & elephant in single column...

6 mois ago | 1

| accepted

Question

Using Java Robot with Multiple Monitors

Hello all, I am using Java Robot to move my mouse, but it is not working across my dual monitor setup. I am using groot to trac...

7 mois ago | 0 answers | 0

Question

Interfacing with External Windows Application Window

Hello all, I am trying to see if there is a way to grab hold of an external (not MATLAB) window, and execute keyboard command...

7 mois ago | 0 answers | 0

Answered

Find elements in a matrix

This really isnt code, or even an attempt....but A = randi([10,100],8,20); B = A(A>=30 & A <= 65); % logically index A using y...

Find elements in a matrix

This really isnt code, or even an attempt....but A = randi([10,100],8,20); B = A(A>=30 & A <= 65); % logically index A using y...

7 mois ago | 0

Answered

find(vector==value) not working

From the FIND documentation To find a noninteger value, use a tolerance value based on your data. Otherwise, the result is some...

find(vector==value) not working

From the FIND documentation To find a noninteger value, use a tolerance value based on your data. Otherwise, the result is some...

7 mois ago | 0

Answered

How to minus two arrays with condition

A = [4 8 14] B = [1 2.5 5 11 17] C = B(3:end) - A % take only the variables from 3 to end of vector A more dynamic approach, ...

How to minus two arrays with condition

A = [4 8 14] B = [1 2.5 5 11 17] C = B(3:end) - A % take only the variables from 3 to end of vector A more dynamic approach, ...

7 mois ago | 0

| accepted

Answered

how to open old MatLab files with .sfit extension?

https://www.mathworks.com/matlabcentral/answers/272067-how-to-get-my-original-x-y-data-from-saved-sfit#answer_212769 ...

how to open old MatLab files with .sfit extension?

https://www.mathworks.com/matlabcentral/answers/272067-how-to-get-my-original-x-y-data-from-saved-sfit#answer_212769 ...

7 mois ago | 0

Answered

For loop through multiple folders

For a cleaner approach (depending on your MATLAB version)... MainDirectory = 'C:\Users\OlavK\OneDrive - NTNU\NTNU\SIMA\Conditio...

For loop through multiple folders

For a cleaner approach (depending on your MATLAB version)... MainDirectory = 'C:\Users\OlavK\OneDrive - NTNU\NTNU\SIMA\Conditio...

7 mois ago | 0

Answered

For loop through multiple folders

file1={'1_101_1', '1_102_2', '2_103_1', '2_104_2', '3_105_1', '3_106_2', '4_107_1', '4_108_2', '5_109_1', '5_110_2', '5_201_1', ...

For loop through multiple folders

file1={'1_101_1', '1_102_2', '2_103_1', '2_104_2', '3_105_1', '3_106_2', '4_107_1', '4_108_2', '5_109_1', '5_110_2', '5_201_1', ...

7 mois ago | 0