Answered
textscan conversion specifier for 1 string N float - possible without specifying '%f' N times?
Unfortunately, the C syntax doesn't allow for a repeat count as does the Fortran FORMAT -- the MATLAB idiom to deal with it is s...

5 years ago | 0

| accepted

Answered
Trouble controlling x-axis values in stackedplot (or having all plots vertically stacked in tiledlayout for 14 columns)
tTry=readtable('Try 4.csv'); stackedplot(tTry,tTry.Properties.VariableNames(2:end),'XVariable','Timestamp') works just fine pe...

5 years ago | 1

| accepted

Answered
MATLAB coder alternatives for textread.
https://www.mathworks.com/matlabcentral/answers/461159-read-text-file-line-by-line-in-deployed-application#answer_374294 indica...

5 years ago | 1

Answered
hours(diff(datetime([t1;t2]))) function
hours(diff(datetime(t1;t2]))) = c You're using hours that is a builtin function as an array name on the LHS of an assignment st...

5 years ago | 0

Answered
How to remove zeros from an element in a cell array
yourarray=cellfun(@(c)c(~-0),yourarray,'UniformOutput',false);

5 years ago | 0

Answered
Function to check whether an array contains a duplicate of elements
function flag=isduplicate(x,v,ix) flag=numel(find(x(ix:end)==v))>1; end x is vector or if x is array in linear addressing o...

5 years ago | 0

Answered
How to set the plot start to zero ? I have some measurements. On the x label, they start from 0 to 6, but from 1 I can see something change on
x=[0:size(Throughput,2)-1].'; % generate temporary x vector for convenience from 0 hL=plot(x,1E-6*Throughput(1:4,;).'...

5 years ago | 1

Answered
Find duplicate entries and sum up their associated values then put everything back in a table
tData = readtable("Data.xlsx"); tData.Properties.VariableNames={'Name','Score'}; % set a known set of variable names tSum=r...

5 years ago | 1

| accepted

Answered
Simple for loop on 90k records runs 51 seconds?!?
for i = 1:height(data)-1 data.duration(i) = data.time(i+1) - data.time(i); ... You've haven't preallocated and even t...

5 years ago | 0

| accepted

Answered
Changing fit line style changes the fit line (fit line shape)
The overloaded plot functions for fit and cfit objects are replete with added functionality -- hard to wade through all the poss...

5 years ago | 0

Answered
operation between timetables with different index
tTicker=readtable('SPCE.csv'); % read the data file tTicker.Yr=year(tTicker.Date;tTicker.Wk=we...

5 years ago | 0

| accepted

Answered
Calculate average over each specific interval
2) first -- how to deal with the last posrtion of the data that shorter than 5 seconds" How do you WANT to deal with it? You ...

5 years ago | 1

| accepted

Answered
Hello, i have a table with many rows and 3 columns. In the first column some values are NaN. How can i put NaN values in the other columns in the same rows?
Use logical indexing; no loops needed -- >> A{isnan(A.A1),:}=nan A = 3×3 table A1 A2 A3 ___ ___ __...

5 years ago | 2

Answered
Matlab -dates for x axis ticks equal spacing
Answered just yesterday or the day before here -- https://www.mathworks.com/matlabcentral/answers/872423-how-to-plot-time-data-a...

5 years ago | 0

| accepted

Answered
match the same files in a loop
f='StokesParameters_Synthetic_Star_Gain_10000000000-Real_5-Int_a=1.5_incl=90.0_pa=90.0_e=0.6_wave=900'; res=split(f,'_'); res=...

5 years ago | 0

Answered
How to segregate data?
Something similar to that looks to me to be about the best can be done -- I'd probably write some helper functions similar to i...

5 years ago | 0

Answered
Add headers to matrix using table
Use new string class features here -- nFiles=4; Header=["Time", "Test "+string(1:nFiles)]; returns a string array as >> Head...

5 years ago | 1

| accepted

Answered
read mat files with specific and dynamic name format and import data
matFiles = dir('s*_results.mat'); myVars = {'results', 'prep'}; varsList=char(join(myVars)); for k = 1:length(matFiles) lo...

5 years ago | 0

Answered
How to plot time data at different/random time intervals?
While not sophisticated to handle general case to isolate the day start locations, the general idea is A1time=datetime(A1time);...

5 years ago | 1

| accepted

Answered
filling missed timestamps using prediction
tData=readtable('data.csv'); tData.Var1=datetime(tData.Var1,'InputFormat','eee MMM dd yyyy'); tData.Properties.VariableNames={...

5 years ago | 0

| accepted

Answered
How to convert decimal into hexadecimal in "S function" Matlab ?
>> uint8(hex2dec(reshape(strrep(sprintf('%#X',2748),'X',''),2,[]).')) ans = 2×1 uint8 column vector 10 188 >>

5 years ago | 0

Answered
how can i change the colors of matrix rows ?
See the Limitations and Tips section of the doc for diary Limitations Because the output of diary is plain text, the log file ...

5 years ago | 0

| accepted

Answered
Remove timestamps (date & time) that appear on every figure by default
While not the answer to the bizarre behavior, a workaround until that can be found and resolved would be delete(findall(gcf,'ty...

5 years ago | 2

Answered
How to find elements of a vector falling between minimum and maximum of an other vector without loop.
>> iswithin(b,min(a),max(a)) ans = 1×2 logical array 1 0 >> is a common-enough idiom I have a utility function for ...

5 years ago | 0

Answered
Incompatible indices after trying to add multiple output rand functions.
As Image Analyst pointed out in his response earlier, FORMAT YOUR CODE PROPERLY! It is much more error-prone when things aren't...

5 years ago | 0

| accepted

Answered
Accessing specific values in every matrix in a cell array
Unfortunately, MATLAB can't do partial array combo addressing -- best I can think of here creates the array xyz as an intermedia...

5 years ago | 1

Answered
Monte Carlo simulation to find weight and statistics calculations
m=mean(Pallete(i)) %should calc mean weight of each pallete, dosent work. s=std(Pallete(i)) %should calc the standard deviation...

5 years ago | 0

| accepted

Answered
RMSE of 1 row of a matrix?
Guessing without a clear definition of what things are and what, exactly it is that is wanted... RMSE=norm(F(1,1:sensor)- F_the...

5 years ago | 0

Answered
Legend in bar plot
A somewhat different approach to Walter's to generate the three needed bar handles -- use a 'stacked' plot with the elements on ...

5 years ago | 1

| accepted

Answered
extracting numbers after the particular string from cell array
Oh. I see I didn't look far enough down the file -- the header stuff ends at record 170; the other data starts at record 171. t...

5 years ago | 1

| accepted

Load more