This commit is contained in:
PinkR1ver 2024-03-20 20:41:15 +08:00
parent 76c53018a0
commit bf19f32af6
12 changed files with 191 additions and 3 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 445 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

View File

@ -25,5 +25,9 @@ date: 2024-03-18
# MATLAB
* [Plot UI components for MATLAB](computer_sci/coding_knowledge/matlab/uicontrol.md)
# JavaScript
*

View File

@ -0,0 +1,54 @@
---
title: Document Object Model
tags:
- javascript
- web
- coding-language
date: 2024-03-20
---
DOM 是指文档对象模型Document Object Model它是 HTML 和 XML 文档的编程接口。它提供了对文档结构、样式和内容的访问和操作。
DOM 将文档表示为一个由**节点和对象组成的树状结构**。*每个节点代表文档中的一个元素*,例如 `<div>`、`<p>` 或 `<img>`。*每个对象都包含一组属性和方法,用于访问和操作节点*。
JavaScript 可以使用 DOM 来:
- 获取和设置元素的属性
- 添加、删除和修改元素
- 绑定事件处理程序
- 操纵文档的样式
- 读取和写入文档内容
**DOM 是 JavaScript 中最重要的 API 之一,它是 Web 开发的基础。**
## Demo code
```js
// 获取元素的属性
const element = document.getElementById("my-element");
const attribute = element.getAttribute("href");
// 设置元素的属性
element.setAttribute("href", "https://www.example.com");
// 添加元素
const newElement = document.createElement("div");
document.body.appendChild(newElement);
// 删除元素
element.parentNode.removeChild(element);
// 绑定事件处理程序
element.addEventListener("click", () => {
// 这是一个事件处理程序
});
// 操纵文档的样式
element.style.color = "red";
// 读取文档内容
const textContent = element.textContent;
// 写入文档内容
element.textContent = "Hello, world!";
```

View File

@ -0,0 +1,129 @@
---
title: Plot UI component in MATLAB
tags:
- matlab
- coding-language
date: 2024-03-20
---
# Demo
```matlab
clear all;close all;clc;
file_path = './signal/signal.xlsx';
signal = readtable(file_path);
mc_signal = load('./signal/mc_signal.txt');
mc_signal = mc_signal';
label = signal.Properties.VariableNames;
t = signal.t;
signal_cell = cell(length(label) - 1,1);
figure;
for i = 1:length(label) - 1
signal_cell{i} = plot(t, signal.(label{i+1}), 'LineWidth', 1.5, 'DisplayName', label{i+1});
hold on;
end
hold off;
xlabel('Time (s)');
ylabel('Amplitude');
title('Signal');
legend('show');
grid on;
grid minor;
prompt = cell(length(label), 1);
for i = 1:length(label) - 1
prompt{i} = ['Show ', label{i+1}];
end
prompt{end} = 'Show All';
show_popupmenu = uicontrol('Style', 'popupmenu', 'String', prompt, 'Position', [20, 20, 100, 25], 'Callback', @(src, event) update_plot_show(src, event, signal_cell));
for i = 1:length(signal_cell)
prompt{i} = ['Hide ', label{i+1}];
end
prompt{end} = 'Hide All';
hide_popupmenu = uicontrol('Style', 'popupmenu', 'String', prompt, 'Position', [140, 20, 100, 25], 'Callback', @(src, event) update_plot_hide(src, event, signal_cell));
delete_noise_button = uicontrol('Style', 'pushbutton', 'String', 'Delete Noise', 'Position', [20, 220, 100, 50], 'Callback', @(src, event) delete_noise(src, event, signal_cell, mc_signal));
function update_plot_show(src, ~, signal_cell)
selectedCurve = get(src, 'Value');
if selectedCurve == length(signal_cell) + 1
for i = 1:length(signal_cell)
set(signal_cell{i}, 'Visible', 'on');
end
return;
end
for i = 1:length(signal_cell)
if selectedCurve == i
set(signal_cell{i}, 'Visible', 'on');
end
end
end
function update_plot_hide(src, ~, signal_cell)
selectedCurve = get(src, 'Value');
if selectedCurve == length(signal_cell) + 1
for i = 1:length(signal_cell)
set(signal_cell{i}, 'Visible', 'off');
end
return;
end
for i = 1:length(signal_cell)
if selectedCurve == i
set(signal_cell{i}, 'Visible', 'off');
end
end
end
function delete_noise(~, ~, signal_cell, mc_signal)
persistent flag;
if isempty(flag)
flag = 1;
end
if flag
for i = 1:length(signal_cell)
signal_cell{i}.YData = signal_cell{i}.YData - mc_signal;
end
flag = 0;
else
for i = 1:length(signal_cell)
signal_cell{i}.YData = signal_cell{i}.YData + mc_signal;
end
flag = 1;
end
end
```

View File

@ -3,7 +3,7 @@ title: Resume
tags:
- resume
- readme
date: 2024-03-07
date: 2024-03-20
---
<div style="margin:auto;width: 50%; transform: translate(50%, 0);">
@ -95,8 +95,9 @@ It was my first class project in college. It was a simple program based on an ol
# 🏆 Honors
* Excellent Graduate of Zhejiang University
* Third Class Scholarship of Zhejiang University
* Award of Honor for Graduate
* [Excellent Graduate of Zhejiang University](assets/pic/outstanding_graduates_of_zhejiang_university.jpg)
* [Third Class Scholarship of Zhejiang University](assets/pic/zhejiang_university_scholarship_third_prize.png)
# 🎈 Clubs & Social Activities