已回答
Textscan import string data from .txt file
Read the file as is and then clean it up instead... d=readcell('202103.txt','Delimiter',newline); % read a cellst...

5 years 前 | 0

| 已接受

已回答
Matlab - problem with snr function
The two inputs have to have the same orientation as well as same length. You've created a row vector above for the noise while ...

5 years 前 | 0

| 已接受

已回答
How to preserve nanosecond precision in datetime calculations (for large numbers)
>> t='1294871257.002060945'; % treat long value as string >> dsec=seconds(str2double(ext...

5 years 前 | 0

已回答
Is it possible to declare a char variable as global?
Seems to work just fine here -- although globals are fraught with danger, if you're cautious the above usage doesn't seem too eg...

5 years 前 | 0

| 已接受

已回答
Loop through folders to pick data file
You shouldn't be putting your data files under the MATLABROOT tree....that's fraught with difficulties when upgrade. MATLAB cre...

5 years 前 | 0

已回答
I need to change n elements in an array chosen randomly
Not totally clear yet just what are valid locations to be changed -- the above code sets the diagonal elements to one anyways; i...

5 years 前 | 0

已回答
How can I perform a set of calculations on multiple matrices located in a csv. file?
Those files have structure to deal with -- generically, one could read the header info and parse it to find out the content -- b...

5 years 前 | 0

已回答
How to save fig in a different folder
mydir='yourfullyqualifiedpath'; savefig(figure(1),fullfile(mydir,'results','h.fig'),'compact'); The above also has the hardcod...

5 years 前 | 0

| 已接受

已回答
Create dir using greek symbol
Which OS/file system? Even if it is allowed by the above combination, I would strongly advise against doing so; it'll just lead...

5 years 前 | 0

已回答
How do I import quarterly data from Excel
>> tQ=readtable('..\Answers\Data_QFE.xlsx'); >> tQ.Year=datetime(tQ.Year,'InputFormat','uuuuQQQ','Format','uuuuQQQ'); >> head(...

5 years 前 | 0

已回答
What is this peak's meaning?
Or, it's just random noise or other non-meaningful artifact; we don't know for sure... How was the frequency axis created to ge...

5 years 前 | 0

| 已接受

已回答
Add x=y line to the scatter plot
hold on plot(xlim,ylim,'-b')

5 years 前 | 2

| 已接受

已回答
Change scale of x-axis on plot
hAx=gca; hAx.XAxis.TickLabelFormat='%d'; hAx.XAxis.Exponent=0;

5 years 前 | 0

已回答
Why do upsample and downsample commands give wrong results in start of sequence?
Don't know what the complaint is, precisely? upsample and downsample are working as documented -- >> upsample(1:4,3) ans = ...

5 years 前 | 0

已回答
Help trying to manually insert peaks after findpeaks through a radio or push button please!
I'll let you deal with coding the callback to a button, but %...your above code here... hAx=gca; ...

5 years 前 | 1

| 已接受

已回答
How exactly does MATLAB calculate a sum of array elements by its sum() function? Does it use any compensated summation algorithm such as Kahan?
TMW does not document publicly algorithms beyond anything provided in the documentation Description section or, occasionally an ...

5 years 前 | 1

已回答
intersect between the second column of cell array A (for all rows) and the first column of cell array B (for all rows)
This may or may not be possible with simple syntax depending upon the content of the cell arrays...if it can work, [H,ih,ik]=i...

5 years 前 | 0

已回答
how to merge 2 variable of different size?
With what expected as result, pray tell? You can't have a 2-column matrix of 25-elements; you could keep the two as elements in...

5 years 前 | 0

已回答
making the x-axis and y-axis fixed for all plots
If you use x/ylim before plotting and then use plot, the auto-scaling will still be in effect for the axis and plot as the high-...

5 years 前 | 0

| 已接受

已回答
I have a function "f" that returns a 1x2 vector, and I need to make a 3x2 matrix M by stacking the outputs f(x1), f(x2), f(x3) on top of each other, but Matlab won't parse it.
The first syntax will work if the function actually returns a vector -- >> x=rand(1,5); >> fnX=@(i)x(i:i+1); >> fnX(1) ans =...

5 years 前 | 0

| 已接受

已回答
what does the "oldx =[x(n);oldx(1:256)]" in the following programm do?
It will (very inefficiently) append the first 255 elements of the (NEW and this is key) oldx vector onto the value of the read-i...

5 years 前 | 0

已回答
Sorting cell for only dublicate values
Alternate approach to Jan's using features of categorical arrays (which the IDs logically are) % some dummy data of the same ty...

5 years 前 | 0

| 已接受

已回答
I have a function (ex. adaptive) in a for loop which has two arrays as output. I want to save all the outputs in a single matrix. it can just save the last vector
You have to index the out arrays on the LHS of the assignment or MATLAB will, as you've observed, overwrite the whole variable o...

5 years 前 | 0

| 已接受

已回答
How can I index a duration variable
Always much easier if you attach the actual code you've used to get to this point and a little bit, at least of the data array. ...

5 years 前 | 0

| 已接受

已回答
How do I pull out from a table, the total mean of one item based on a particular condition (for several subjects), and then compute the difference in mean values?
tMEANS=rowfun(@mean,tData,'GroupingVariables'{'ConditionZ'},'InputVariables','ItemA','OutputVariableNames','GroupedMeans'); See...

5 years 前 | 0

已回答
Help creating loop that converts text to numbers
>> A='Now is the time...'; >> format short >> disp(double(A)) 78 111 119 32 105 115 32 116 104 101 ...

5 years 前 | 0

已回答
Removing quotations from table display
It's more a sanity check for the user to make sure their values are correct for what they expect. And there's where the purpose...

5 years 前 | 0

已回答
fwrite ascii output error
I see no such thing... >> fid=fopen('test2.dat'); fread(fid,'*int16') fid=fclose(fid); ans = 2×1 int16 column vector ...

5 years 前 | 0

已回答
How to reform cell into a vector of strings and text
Two of many ways to deal with the cellstr -- As string array >> S=string(split(C,',')); S=S(S~="") S = 6×1 string array ...

5 years 前 | 0

已回答
How do I swap 2 rows of a cell array?
One way... >> C=num2cell(randi(10,3,2)) C = 3×2 cell array {[5]} {[1]} {[9]} {[5]} {[6]} {[5]} >> ...

5 years 前 | 0

| 已接受

加载更多