Answered
Extracting values by looping through multiple files
displ=[]; % empty displacement array... d=dir('*.out'); for i=1:numel(d) txt=fileread(d...

7 years ago | 0

| accepted

Answered
Split table at n rows and plot data
In general, I'd process something like the following -- you can add control variables to select which columns you want plotted; ...

7 years ago | 0

| accepted

Answered
how can I open any file with a .TXT file, read and print the data correctly?
fileID = fopen('*.TXT', 'r'); is invalid syntax-- fopen() can't use wild cards; tha'ts a dir functionality-- d=dir('*.TXT'); ...

7 years ago | 0

Answered
Convert Time(string) to Time(number)
A little bit circuitous as for some reason TMW doesn't let one create a duration array from scanning text...why is beyond my ken...

7 years ago | 0

Answered
how to identify matlab identify a cell(title) in excel and use it as a variable.
Matlab turns column header text into allowable variable names by using the underscore to fill in spaces and appending suffix int...

7 years ago | 0

| accepted

Answered
Operands to the || and && operators must be convertible to logical scalar values.
Presuming FS and Depth are vectors, then you need to subscript them as, for example if FS(i) < 1 && Depth(i)<20 in all expres...

7 years ago | 0

Answered
Plotting dates as text in the x-axis
To plot as ordinal position in the array instead of in order (what else could plot do with actual values on an axis with numeric...

7 years ago | 1

Answered
Referencing a position for a subplot
title(sprintf('Hourly Variations for Hour %d Demand',n))

7 years ago | 0

| accepted

Answered
Calculating Percentile from a pdf
If I interpret the want correctly...let z,v be your two columns--then ecfn=ecdf(v); % empirical cumulative distribution ...

7 years ago | 0

| accepted

Answered
How to filter data from a timetable based on a string value?
Probably something like isfixed=contains(tt.assets,'fixedinc'); % if string or cell string, should locate tt(isfixed,:) ...

7 years ago | 1

| accepted

Answered
Problem Loading a Design Matrix File
The first error message tells you precisely why it's happening -- the third line of the file doesn't have the same number of val...

7 years ago | 0

Answered
Create aditional legend on bar chart
Oh, the infamous bar again! What a difficult implemtation it is to do anything with... :( Believe it or not, you must do somet...

7 years ago | 1

| accepted

Answered
Change Colors of bar chart
Your variable Figure is the handle of the figure, not the handle of the bar object you're trying to manipulate. You'll have to ...

7 years ago | 1

Answered
variables are not saved in workspace after function.
It can't--you don't return anything. Read about functions at https://www.mathworks.com/help/matlab/ref/function.html

7 years ago | 1

Answered
Comparison of FFT codes
Compare size(S) between the two cases and you'll see the difference--and do you see why there is that difference? The differen...

7 years ago | 0

| accepted

Answered
Select largest elements of each row of a matrix while keeping the position of the values
Use MATLAB vector syntax--no loops needed (or wanted! :) ) -- nHALF=fix(size(ACWI,2)/2); [~, ixPos] = maxk(ACWI.Scores.Carbon,...

7 years ago | 0

| accepted

Answered
Can I run my script on multiple files sequentially according my existing file name at once
In your function you need to remove the hardcoded path and pass the qualified filename you built in your looping script-- funct...

7 years ago | 0

| accepted

Answered
Legend title won't display correctly.
OK, I see I overlooked the needed (albeit hidden) property that needed most to get where you want to go... Try exploring from t...

7 years ago | 0

| accepted

Answered
find peaks and distance between the x axis
Actually, I reversed the order of arguments when using two in findpeaks in first answer -- the x location is the optional second...

7 years ago | 0

Answered
find peaks and distance between the x axis
%load the data from excel xy=xlsread('final.xlsx'); % read the sheet only once x=xy(:,1); y=xy(:,2); % make local va...

7 years ago | 0

Answered
find peaks and distance between the x axis
The position is NOT uniformly increasing -- is for most of the data, but not all... >> all(diff(data(:,1))>0) ans = logical...

7 years ago | 0

Answered
Remove non time string values in a time matrix
Use the datetime class is probably easiest...see if tm=datetime(time_mat,'InputFormat','hh:mm:ss.SSS'); % convert to...

7 years ago | 0

Answered
How to split up column vector
In general, if you're thinking of starting with vector V and creating subvectors, say, A, B, C, ..., this is a very bad idea. I...

7 years ago | 1

| accepted

Answered
How to create a matrix (64 X 6) with all numbers from 1 to 64, written by binary code?
D=double(dec2bin(0:63,6))-'0';

7 years ago | 0

| accepted

Answered
Split 2 lines of a matrix?
B=[A(3:4,:);A]; % create new array keeping old A=[A(3:4,:);A]; % new array replaces/augments old More genericall...

7 years ago | 0

| accepted

Answered
Dont know what Polyval is here doing :-/
You fit yd2 vs xd1 but then plotted against xd2. One presumes the fit should be against xd2 as well. BUT: A perfect illustrat...

7 years ago | 2

| accepted

Answered
Why does fplot think my function is not vectorized
Because fplot is just looking at the source code, not the output and it doesn't recognize the reshape operation at the end--only...

7 years ago | 1

Answered
How to pick a set of data close to one another
Is the reference fixed/known a priori, computed from the overall dataset...??? Presuming the former above and is xref, and othe...

7 years ago | 0

| accepted

Answered
How to filter out missing data from a text file with readtable()? Different data types in the same column.
Use the 'TreatAsEmpty' named argument to read the M lines as empty and will return NaN. Then just delete the rows that return i...

7 years ago | 1

Load more