Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions index.htm
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ <h2>Select</h2>
<input type="button" class="btn btn-primary" value="select" onclick="access();" />
</p>

<p>
<input type="button" class="btn btn-primary" value="select row" onclick="accessRows();" />
<input class="btn" name="rows" id="rows" placeholder="rows" type="number" />
</p>

</div>
</td>
<td id="textbox">
Expand Down
15 changes: 15 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ const reshape = (arg) => {
}

// Select
let rows = document.getElementById("rows");

const access = () => {
if (variable.value === "") {
return alert("Please enter a variable name in the 'Create Tensor' section.");
Expand All @@ -145,5 +147,18 @@ const access = () => {
keep = ", " + column.value;
}

document.editor.textbox.value+="\n" + variable.value + "_select = " + variable.value + "[" + row.value + keep + "]";
}
}

const accessRows = () => {
if (variable.value === "") {
return alert("Please enter a variable name in the 'Create Tensor' section");
} else if (row.value === "") {
return alert("Please enter a number in the 'row' field in the 'Tensor functions' section.");
} else if (rows.value === "") {
return alert("Please enter a number in the 'rows' field in the 'Select' section.");
} else {
document.editor.textbox.value+="\n" + variable.value + "_rows = " + variable.value + "[" + row.value + "::" + rows.value + "]";
}
}
Loading