Respondida
How to create a vector based on previous value of same vector
I suspect overall performance will not be significantly improved as removing a small fraction of a total run time entirely will ...

más de 7 años hace | 0

Respondida
Trimming Null Characters off a multi-dimensional cell array
>> A(any(~cellfun(@isempty,A),2),:) ans = 3×3 cell array {'a' } {'b'} {'c' } {'t' } {'y...

más de 7 años hace | 0

| aceptada

Respondida
Loop reading data into equation, store into array
data=importdata('yourfile.txt'); ix2=[false; abs(diff(ata(:,5)>=2))]; newdata=data(ix2,[3 5]);

más de 7 años hace | 0

Respondida
Cleaning of large files of data
Start something like ttclean=rmissing(tt); % the subset with no missing data only dt=diff(ttclean.Time); % the di...

más de 7 años hace | 0

| aceptada

Respondida
How can I send data, or extract data, from a range of cells in a Uitable?
Well, experimenting shows you can address subarrays...one of the examples given modified slightly-- hF=figure; ...

más de 7 años hace | 0

Respondida
How make this code execute faster?
Try S1 = setdiff(1:N;S)); What is the precise definition of "runs slow(ly)"? In what context and how have you deduced/conclud...

más de 7 años hace | 0

Respondida
Why do I get an array out of bounds error
out(n) = out(n) + channel(n-fix(LFO(n))); the subscript for channel is n-fix(LFO(n)) where LFO=200*sin(t) so fix(LFO) ranges fr...

más de 7 años hace | 0

| aceptada

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

más de 7 años hace | 0

| aceptada

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

más de 7 años hace | 0

| aceptada

Respondida
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'); ...

más de 7 años hace | 0

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

más de 7 años hace | 0

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

más de 7 años hace | 0

| aceptada

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

más de 7 años hace | 0

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

más de 7 años hace | 1

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

más de 7 años hace | 0

| aceptada

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

más de 7 años hace | 0

| aceptada

Respondida
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,:) ...

más de 7 años hace | 1

| aceptada

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

más de 7 años hace | 0

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

más de 7 años hace | 1

| aceptada

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

más de 7 años hace | 1

Respondida
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

más de 7 años hace | 1

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

más de 7 años hace | 0

| aceptada

Respondida
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,...

más de 7 años hace | 0

| aceptada

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

más de 7 años hace | 0

| aceptada

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

más de 7 años hace | 0

| aceptada

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

más de 7 años hace | 0

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

más de 7 años hace | 0

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

más de 7 años hace | 0

Respondida
I have a cell matrix and would like to merge these all columns together vertically. How can I do that?
data=cell2mat(data.');

más de 7 años hace | 0

| aceptada

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

más de 7 años hace | 0

Cargar más