Answered

Three variables (two independent) 3D plotting

M=1; N=2; flg=true; for B=-20:20; X=M+B;l T=[]; for L=-10:10; Y=N+X; r=B+Y+L^2; sca...

Three variables (two independent) 3D plotting

M=1; N=2; flg=true; for B=-20:20; X=M+B;l T=[]; for L=-10:10; Y=N+X; r=B+Y+L^2; sca...

21 minuter ago | 0

Answered

How can we convert struct file to txt file?

arrayfun(@(s) writematrix([s.S s.F],[s.ID '.txt']),structWheeze)

How can we convert struct file to txt file?

arrayfun(@(s) writematrix([s.S s.F],[s.ID '.txt']),structWheeze)

ungefär en timme ago | 0

Answered

How can I link data from separate arrays?

Making harder than needs must be -- Thickness=[19.0;22.0;32.0]; Temp_data=cat(3l [0,-0.05;0.2,-0.13;0.4,0.25;0.6,0.64;0.8,0.56...

How can I link data from separate arrays?

Making harder than needs must be -- Thickness=[19.0;22.0;32.0]; Temp_data=cat(3l [0,-0.05;0.2,-0.13;0.4,0.25;0.6,0.64;0.8,0.56...

en dag ago | 1

| accepted

Answered

How to find corresponding frequencies after viewing amplitude in descending order?

[DescendAmp,idx] = sort(peak_ft,'descend'); disp([peak_fr(idx) peak_ft])

How to find corresponding frequencies after viewing amplitude in descending order?

[DescendAmp,idx] = sort(peak_ft,'descend'); disp([peak_fr(idx) peak_ft])

en dag ago | 0

Answered

plot discontinuous x axis

Divide the time vector by T(end) for each trace and then plot versus the normalized time [0 1] instead...

plot discontinuous x axis

Divide the time vector by T(end) for each trace and then plot versus the normalized time [0 1] instead...

en dag ago | 0

Answered

How to Enclose a Figure Title in a Box?

hT=title('This is a title','EdgeColor','k');

How to Enclose a Figure Title in a Box?

hT=title('This is a title','EdgeColor','k');

en dag ago | 0

| accepted

Answered

Comparing date/time values in Matlab/ calling out date time values to use in code

Convert to a timetable and all kinds of tools are available; see <Overview Timetables> for all of the above kinds of operations

Comparing date/time values in Matlab/ calling out date time values to use in code

Convert to a timetable and all kinds of tools are available; see <Overview Timetables> for all of the above kinds of operations

3 dagar ago | 0

| accepted

Answered

Creating a Histogram of Letter grades converted from number grades

One way that illustrates lookup table approach... GRADES=[0,60,69.9,73.9,76.9,79.9,83.9,86.9,89.9,94.9,95.9,100]; % letter grad...

Creating a Histogram of Letter grades converted from number grades

One way that illustrates lookup table approach... GRADES=[0,60,69.9,73.9,76.9,79.9,83.9,86.9,89.9,94.9,95.9,100]; % letter grad...

4 dagar ago | 0

Answered

Bestfit value doesn't match with the plotted value

Because you used gaussian_fn= @(q,x) (q(1)^2.*exp(-2.*((x-q(2)).^2)/q(3).^2)); as your fitting function -- in which q(1) is sq...

Bestfit value doesn't match with the plotted value

Because you used gaussian_fn= @(q,x) (q(1)^2.*exp(-2.*((x-q(2)).^2)/q(3).^2)); as your fitting function -- in which q(1) is sq...

4 dagar ago | 0

| accepted

Answered

Groupsummary on timetable with cell/matrix data

Took a little head-scratching, but the following appears to work as desired-- fnMN3=@(c){mean(cat(3,c{:}),3)}; % functio...

Groupsummary on timetable with cell/matrix data

Took a little head-scratching, but the following appears to work as desired-- fnMN3=@(c){mean(cat(3,c{:}),3)}; % functio...

4 dagar ago | 0

| accepted

Answered

How to calculate the coefficient of variation in Matlab

N=30; mn=mean(reshape([time(:),speed(:)],N,[])); sd=std(reshape([time(:),speed(:)],N,[])); cv=reshape(mn./sd,[],N); return...

How to calculate the coefficient of variation in Matlab

N=30; mn=mean(reshape([time(:),speed(:)],N,[])); sd=std(reshape([time(:),speed(:)],N,[])); cv=reshape(mn./sd,[],N); return...

5 dagar ago | 0

| accepted

Answered

No legend when plotting fit object

Doesn't seem to be any way to prevent the builtin fit object plot() routine from adding the legend. Instead, use plot(x,myfit(...

No legend when plotting fit object

Doesn't seem to be any way to prevent the builtin fit object plot() routine from adding the legend. Instead, use plot(x,myfit(...

5 dagar ago | 0

| accepted

Answered

How to create a new array with specific column and row thresholds from txt file

Why do you keep reverting to the hardest way possible to read in a data file? We just showed how easy it is to use readtable @...

How to create a new array with specific column and row thresholds from txt file

Why do you keep reverting to the hardest way possible to read in a data file? We just showed how easy it is to use readtable @...

5 dagar ago | 0

Answered

Multiple 2D plots in 1 3D plot

Well, your data look nothing at all like those in the sample plot and your vectors aren't of commensurate lengths, but-- plot3(...

Multiple 2D plots in 1 3D plot

Well, your data look nothing at all like those in the sample plot and your vectors aren't of commensurate lengths, but-- plot3(...

5 dagar ago | 0

| accepted

Answered

Loading a 600 mb file ends up astronomically large

Attach the file (or at least a portion of it). Memory usage is only 1:1 with disk storage for numeric data types stored as stre...

Loading a 600 mb file ends up astronomically large

Attach the file (or at least a portion of it). Memory usage is only 1:1 with disk storage for numeric data types stored as stre...

5 dagar ago | 0

Answered

Reading csv file and counting number of lines that have a category of interest and are below a threshold

>> data=readtable('SampleDataset03.csv'); >> sum(contains(data.Category,'A')&data.Value<0.5) ans = 64 >> For this you d...

Reading csv file and counting number of lines that have a category of interest and are below a threshold

>> data=readtable('SampleDataset03.csv'); >> sum(contains(data.Category,'A')&data.Value<0.5) ans = 64 >> For this you d...

5 dagar ago | 0

| accepted

Answered

plot un-equally spaced data in errorbar

You're looking for x1 = [28 56 112 224]; y1 = [21.2 18.01 16.8 14.38]; sd_vct1 = [4.93 1.77 1.81 2.32]; errorbar(x1,y1,sd_vc...

plot un-equally spaced data in errorbar

You're looking for x1 = [28 56 112 224]; y1 = [21.2 18.01 16.8 14.38]; sd_vct1 = [4.93 1.77 1.81 2.32]; errorbar(x1,y1,sd_vc...

5 dagar ago | 0

| accepted

Answered

removing spcific numbers from matrix

Don't need (and don't use) loops -- this is MATrix LABoratory, after all! :) A=A(~ismember(A,B)); or A=setxor(A,B); is the ...

removing spcific numbers from matrix

Don't need (and don't use) loops -- this is MATrix LABoratory, after all! :) A=A(~ismember(A,B)); or A=setxor(A,B); is the ...

6 dagar ago | 0

| accepted

Answered

READ TABLE WITH DIFFERENT SETTING INSIDE

It's a fignewton of looking at the text in the editor or on the screen--some was tab-delimited, some space but there's only one ...

READ TABLE WITH DIFFERENT SETTING INSIDE

It's a fignewton of looking at the text in the editor or on the screen--some was tab-delimited, some space but there's only one ...

6 dagar ago | 0

| accepted

Answered

Create heatmap from table, error "'XVariable' value must reference a single variable in the source table."

The x,y variables for a table are given as the names of the wanted columns; the dot notation returns the data. heatmap(data_mea...

Create heatmap from table, error "'XVariable' value must reference a single variable in the source table."

The x,y variables for a table are given as the names of the wanted columns; the dot notation returns the data. heatmap(data_mea...

6 dagar ago | 0

Answered

Save generated points in txt file

ndgrid generates X,Y as arrays; in your case 3x3. For output you need to convert to vectors before making the table... T=table...

Save generated points in txt file

ndgrid generates X,Y as arrays; in your case 3x3. For output you need to convert to vectors before making the table... T=table...

7 dagar ago | 0

Answered

cell indexing, extracting rectangular subset

I just duplicated your example 5 times... tokens=tokens.'; % reshape to column cell array vals=cell2mat(cellfun...

cell indexing, extracting rectangular subset

I just duplicated your example 5 times... tokens=tokens.'; % reshape to column cell array vals=cell2mat(cellfun...

8 dagar ago | 0

Answered

How to build and call an array of objects containing a table of data

How about something like test=timetable(datetime(2020,2,13+[0;sort(randi(20,4,1))]),randi([120 240],5,1),'VariableNames',{'Temp...

How to build and call an array of objects containing a table of data

How about something like test=timetable(datetime(2020,2,13+[0;sort(randi(20,4,1))]),randi([120 240],5,1),'VariableNames',{'Temp...

9 dagar ago | 1

| accepted

Answered

How to get real p value in the 'multicompare' output table instead of rounded number

As Walter points out beflow, that it prints an integer zero indicates the calculation of the p-value underflowed and the returne...

How to get real p value in the 'multicompare' output table instead of rounded number

As Walter points out beflow, that it prints an integer zero indicates the calculation of the p-value underflowed and the returne...

9 dagar ago | 0

| accepted

Answered

How to Compare multiple rows of the Same txt file at the same time.

Read the file(s) into memory with importdata or other high-level function appropriate to the format; then use diff() on the seco...

How to Compare multiple rows of the Same txt file at the same time.

Read the file(s) into memory with importdata or other high-level function appropriate to the format; then use diff() on the seco...

9 dagar ago | 0

Answered

Resizing Figure to Make Room for Title without Resizing Plot

hAx=gca; hAx.Position=hAx.Position.*[1 1 1 0.95]; adjusts the height of axes to be 95% of default/previous height. Adjust to ...

Resizing Figure to Make Room for Title without Resizing Plot

hAx=gca; hAx.Position=hAx.Position.*[1 1 1 0.95]; adjusts the height of axes to be 95% of default/previous height. Adjust to ...

9 dagar ago | 0

| accepted

Answered

fitting a sloped gaussian

First pass...overall not so great; need to do more to figure out how to model background. My spectroscopy background has dealt ...

fitting a sloped gaussian

First pass...overall not so great; need to do more to figure out how to model background. My spectroscopy background has dealt ...

9 dagar ago | 0

Answered

I am trying to find the shortest path possible in an array of numbers using MATLAB and I keep getting "Index in position 1 exceeds array bounds (must not exceed 5).". I tried changing 5 to any other number and it didn't work. Can anyone please help?

Easy to forget/overlook... n=1: ... while itr < 5 distance = distance + norm([randomA(n,1) randomA(n,2)] - [randomA(n+1,1)...

I am trying to find the shortest path possible in an array of numbers using MATLAB and I keep getting "Index in position 1 exceeds array bounds (must not exceed 5).". I tried changing 5 to any other number and it didn't work. Can anyone please help?

Easy to forget/overlook... n=1: ... while itr < 5 distance = distance + norm([randomA(n,1) randomA(n,2)] - [randomA(n+1,1)...

10 dagar ago | 0

| accepted

Answered

Writing a small epsilon in xlabel with color

W/o taking time to try to figure out specific LaTeX syntax inside MATLAB that's always a pain since know nuthink' about LaTeX ot...

Writing a small epsilon in xlabel with color

W/o taking time to try to figure out specific LaTeX syntax inside MATLAB that's always a pain since know nuthink' about LaTeX ot...

10 dagar ago | 0