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 @@ -82,7 +82,12 @@ <h2>Select</h2>

<p>
<input type="button" class="btn btn-primary" value="select row" onclick="accessRows();" />
<input type="button" class="btn btn-primary" value="select column" onclick="accessColumn();" />
</p>

<p>
<input class="btn" name="rows" id="rows" placeholder="rows" type="number" />
<input class="btn" name="columns" id="columns" placeholder="columns" type="number" />
</p>

</div>
Expand Down
15 changes: 15 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ const reshape = (arg) => {

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

const access = () => {
if (variable.value === "") {
Expand Down Expand Up @@ -162,3 +163,17 @@ const accessRows = () => {
document.editor.textbox.value+="\n" + variable.value + "_rows = " + variable.value + "[" + row.value + "::" + rows.value + "]";
}
}

const accessColumn = () => {
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 if (columns.value === "") {
return alert("Please enter a number in the 'columns' field in the 'Select' section.");
} else {
document.editor.textbox.value+="\n" + variable.value + "_column = " + variable.value + "[" + row.value + ":" + rows.value + ", " + columns.value + "]";
}
}
3 changes: 3 additions & 0 deletions styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,6 @@ input[type="number"] {
width: 60px;
}

#columns {
width: 70px;
}
Loading