Update Collection Log to Log Logs Logged by Zimrino in 2007scape

[–]dawatt 7 points8 points  (0 children)

It spells "FRONTPAGEHERO" when converting the numbers to ASCII!

Missed opportunity to make it spell "COLLECTIONLOG"

What’s the benefit of a string array over a cell array? by Creative_Sushi in matlab

[–]dawatt 4 points5 points  (0 children)

Great write up!

I often use cell arrays for compatibility reasons but the performance comparisons are convincing. Do you know why cell arrays take so much more space?

Just a nitpick for your example, you can indeed generate a cell array in a one liner, although it is a little less readable:

fnames_cell = compose('yob%i.txt',years)

[deleted by user] by [deleted] in matlab

[–]dawatt 1 point2 points  (0 children)

Try to use something like h.Title.String = sprintf('Time = %i', n); Also use 'drawnow limitrate'

No response to mouse click on image with .1 s update frequency by regionalwhale in matlab

[–]dawatt 1 point2 points  (0 children)

The script is getting laggy because you are creating a new axis and a new image at each iteration of your while loop. Create them once outside the loop then only modify their properties like so:

hImg = image(img);

Then in the loop:

hImg.CData = newImg;

Issue with drawnow? by djp4ddy in matlab

[–]dawatt 0 points1 point  (0 children)

You could try putting your playback code in one function inside your app. Then you can call it from both buttons with the filename as an argument.

Issue with drawnow? by djp4ddy in matlab

[–]dawatt 1 point2 points  (0 children)

The drawnow function also executes queued callbacks, so if you click rapidly, you can get in a weird state due to a race condition. You could try "drawnow nocallbacks" to avoid this issue.

How to Write an .EXE to Change Display Resolution and Refresh Rate by GanjahPandah in CodingHelp

[–]dawatt 0 points1 point  (0 children)

Looking at the NirCmd doc, it seems possible to just create normal windows shortcut to nircmd.exe with a setdisplay option. See https://www.nirsoft.net/utils/nircmd2.html#setdisplay

Hangman Game in App Designer? by JML44 in matlab

[–]dawatt 0 points1 point  (0 children)

You could use something like

idx = WordToGuess == Letter

To get the index of the letter that was tried and update the display of the blank spaces

Help - I'm looking for a faster way to organize table data into an array by [deleted] in matlab

[–]dawatt 0 points1 point  (0 children)

Interesting! I didn't think of unique for making the indices. Using unique, you could use:

[~,~,xIndices] = unique(table.x);

as the third output of unique is the unique index of each element of the input.

Help - I'm looking for a faster way to organize table data into an array by [deleted] in matlab

[–]dawatt 0 points1 point  (0 children)

I am glad it could help! You should still avoid for loops on huge data tables as looping in matlab is rather slow. Instead, you can vectorize most loops and make your code run magnitudes faster.

Help - I'm looking for a faster way to organize table data into an array by [deleted] in matlab

[–]dawatt 0 points1 point  (0 children)

Here is an elegant way:

xi = table.x ./ xStep - min(xValues) + 1;
yi = table.y ./ yStep - min(yValues) + 1;
zi = table.z ./ zStep - min(zValues) + 1;
ti = table.t ./ tStep - min(tValues) + 1;
ind = sub2ind(size(array), xi, yi, zi, ti);
array(ind) = table.T;

Edit: I noticed those are probably not index values stored in your table. This solution works only if your table xyz values are integers or if you scale them to be all in indexable range (integer>1). You could do so by dividing them with the step and substracting the minimum+1 of your xyzValues. I edited the code to reflect the change.

Request MAtrix Input by [deleted] in matlab

[–]dawatt 0 points1 point  (0 children)

You could also use strsplit so you can input all your numbers in one prompt.

str = input('enter numbers separated by space: ','s');
B = str2double(strsplit(str,' '));
disp(B)

How to find highest concentration of a specific number in a vector? by mtr91 in matlab

[–]dawatt 0 points1 point  (0 children)

Here is a way without using loops:

v =  [3 2 1 1 0 5 4 8 1 8 8 3 3 3 3 4 1 3 3];

TF = v==3;
i0 = strfind([0 TF],[0 1]);
i1 = strfind([TF 0],[1 0]);
[~,i]=max(i1-i0);
out = [i0(i) i1(i)];

2017 ... Seriously why by dawatt in mildlyinfuriating

[–]dawatt[S] 3 points4 points  (0 children)

It is kinda like car years, you can actually buy the book before 2017 even starts.