How can I plot from csv file?

3 views (last 30 days)
Hi!
I am try to plot this csv file with shadowed error. (this is my photometry deltaF/F data with s.e. and I caculate average using excel )
Actually my lab person show to me but after than he delete code.
So I know I need caculate x as time using frame rate, and show him this note from TDT data.
Thanks for your help!
Object ID : RZ5P(1) - RZn Processor
Rate : 6103.5 Hz
Store ID : PC2/
Source : Strobe input
Invert : No
Offset : Yes
Count : Yes
Store ID : PC3/
Source : Strobe input
Invert : No
Offset : Yes
Count : Yes
Object ID : FibPho1 - Fiber Photometry
Store ID : 470A
Format : Float-32
Scale : Unity
Rate : 1000.0 Hz
Store ID : 405A
Format : Float-32
Scale : Unity
Rate : 1000.0 Hz
Store ID : Fi1d
Format : Float-32
Scale : Unity
Rate : 6103.5 Hz
Store ID : Fi1i
Mode : Single scalar
Format : Float-32
Scale : Unity
Pre Cap : 0.00 ms
Store ID : Fi1r
Format : Float-32
Scale : Unity
Rate : 6103.5 Hz

Accepted Answer

Sulaymon Eshkabilov
Sulaymon Eshkabilov on 10 May 2023
Here is how to get some shadow error plot:
% Way 1. Not nice looking plot
D = readmatrix('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1379164/photometry.csv');
t = D(1,:); % Note that your time data is repeated values.
% That is why the time signal is recreated
t = linspace(min(t), max(t), numel(t));
y1 = (D(2,:));
SE = D(3,:);
y2 = (y1 + SE);
figure
ax = axes;
patch([t fliplr(t)], [y1 fliplr(y2)], [0.8 0.8 0.8], 'EdgeColor', 'r', 'FaceAlpha', 0.5)
grid on
ax.XAxisLocation = 'origin';
hold on
yy = .5*(y1+y2);
plot(t, yy, 'k', 'LineWidth', 2)
% Way -2. Nice looking plot
%% Smooth your data and plot it:
D = readmatrix('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1379164/photometry.csv');
t = D(1,:);
t = linspace(min(t), max(t), numel(t));
y1 = smoothdata(D(2,:));
SE = D(3,:);
y2 = smoothdata(y1 + SE);
figure
ax = axes;
patch([t fliplr(t)], [y1 fliplr(y2)], [0.8 0.8 0.8], 'EdgeColor', 'r', 'FaceAlpha', 0.5)
grid on
ax.XAxisLocation = 'origin';
hold on
yy = .5*(y1+y2);
plot(t, yy, 'k', 'LineWidth', 2)
  1 Comment
Gyujin Park
Gyujin Park on 14 May 2023
Wow!
Thank you so much!!
I learn about Matlab and hope can create as like you!
Thanks again XD

Sign in to comment.

More Answers (0)

Categories

Find more on Data Type Identification in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!