Risposto
Subtracting values form rows with same variable
If you have trouble with Matlab basics you may consider doing the Onramp tutorial (which is provided for free by Mathworks). It...

3 mesi fa | 0

| accettato

Risposto
How do I perform a formatted read on exponential data?
Edit at the top: You can get the data in this format with my readfile function, or with data=cellstr(readlines(filename));. T...

3 mesi fa | 0

Risposto
Acess all last array elements withtin cells
Loops are faster than cellfun (excluding the legacy syntax). The reason is that cellfun will hide the loop internally and you ha...

4 mesi fa | 0

Risposto
Find the desired row in the matrix
Inspired by the answer and comment by Jan, I gave it a try as well. However, at least for this size, the answers from Jan are fa...

4 mesi fa | 1

Risposto
How to plot x = 1 without any y variable
doc xline

4 mesi fa | 0

Risposto
fprintf modifying txt file in the wrong way
If it's a sufficiently old program, it might expect a carriage return along with a line end. I would suggest reading the file...

4 mesi fa | 0

Risposto
Error in using an element in a matrix as function input
You need to pass the entire array, or treat each element as a separate variable. You can of course create the c array inside you...

4 mesi fa | 1

| accettato

Risposto
how do I generate a random signal with each point being -1 or +1 in MATLAB
randi([0 1],1,N)*2-1 That should do it. Or even this: sign(rand(1,N)-0.5) Although it is possible that generates a ...

4 mesi fa | 1

| accettato

Risposto
What will be the regex for this type of string?
expr = 'V/d*_/d*_/d*'; Or, if 'any' actually means '1 or more': expr = 'V/d+_/d+_/d+';

4 mesi fa | 0

Risposto
Convert list of points into string and group it in tens
I would suggest putting each section in a cell, so you can easilly add the headers: points = randi(10,36,2); PointsPerSection ...

4 mesi fa | 0

| accettato

Risposto
Diary command does not capture command window results from a script file.
Even setting a full path for the diary file didn't work. DiaryFileName = fullfile(tempdir,'myFile.txt'); diary(DiaryFileName) ...

4 mesi fa | 0

Risposto
How to perform different task on one single button pushed one by one to perform one by one task
You can use a persistent variable to keep track of the number of times the callback was called: persistent NumberOfCalls if is...

4 mesi fa | 0

Risposto
Fast binary decoding of very large matrix of uint8s
It might not be the absolute fastest method, but this should be about 3 times faster x=uint8(randi(256,1e7,40)-1); tic y1 =...

4 mesi fa | 0

| accettato

Risposto
Error evaluationg 'OpenFcn' because of a waitfor command
You need to use return instead of guidata(hObject,handles) if the figure no longer exists. If you want more specific advice, yo...

4 mesi fa | 0

| accettato

Risposto
Indexing 3D arrays using vectors of indexes
The problem with indexing in Matlab is that it will grab every pair of indices, which is not always what you want. The easies...

4 mesi fa | 0

| accettato

Risposto
How to operate block matrices?
Perhaps a function like pagemtimes does what you need. You will have to store your matrix as a 3-D matrix. Even if pagemtimes i...

4 mesi fa | 1

| accettato

Risposto
Change description in File Exchange contribution
I just tried with one of my submissions that's linked to GitHub. If you click the edit button (see screenshot below) you will b...

4 mesi fa | 0

| accettato

Risposto
Find the nearest two values in all grid cells to a specified value across a 3D matrix
Why squeeze the indices? Just use them to index (for which you need sub2ind). As for the second closest: the easiest way is to ...

4 mesi fa | 0

| accettato

Risposto
Calling the error function does not print the line number in r2022b
I personally use my own customized versions of error and warning. They take an options struct as the first argument to determine...

4 mesi fa | 0

Risposto
Pseudorandom character matrix generation
If you want a 10x10 char array, you can also use indexing: source = 'bdpq'; Array = source(randi(end,[10 10]))

4 mesi fa | 0

| accettato

Risposto
If not with a xlsx file
You should have used isempty in your current code: if ~isempty(app.filename) For the test you now want to do, you should extra...

4 mesi fa | 0

| accettato

Risposto
Saving file causes glitch
As a temporary workaround you can use this: edit my_script.m % should give you a popup asking if you want to create the file O...

4 mesi fa | 0

Risposto
Fitting data from file
You can specify those parameters, but what is much more effective is providing good initial guesses (and not mixing up x and y):...

4 mesi fa | 1

| accettato

Risposto
get alpha (color) value of a line
I have no clue why this is hidden, but converting the object to a struct and hunting for a few appropriate candidates I found th...

4 mesi fa | 1

| accettato

Risposto
Appending mixed types to strings seems a bit tricky. Is this the intended behaviour?
It helps to do this step by step, which show that (while unintuitive), this is intended behavior. Matlab evaluates code from le...

4 mesi fa | 3

| accettato

Risposto
How to assign matrices to an array in a for loop
You can use a cell array: for i = 1:5 matrices{i} = [i*1 i*2 i*3; i*4 i*5 i*6; i*7 i*8 i*9]; end

4 mesi fa | 1

| accettato

Risposto
APP Designer code convert to CPP code
Do you need to generate the C++ code, or is it also fine to end up a stand-alone executable? As the message indicates, UIFigure...

5 mesi fa | 0

Risposto
Difference between "||" and "&&" in my loop
The or operator means and/or, just like it does in mathematics. You can use the xor function (although no operator or short-circ...

5 mesi fa | 0

Risposto
How to reduce the file size of a saved histogram figure
You have two options that I'm aware of: # Change the underlying data so you reproduce the same bins with fewer data points. ...

5 mesi fa | 1

Risposto
Computational cost of the commanda 'path'
Once you are at the stage where the profiler makes any sense at all, you should question why you are still using scripts instead...

5 mesi fa | 0

| accettato

Carica altro