# Rik

Followers: 0 Following: 0

E-mails with feedback/questions about FEX submissions are welcomed. In general I will post e-mails about Answers on the related page, unless there is good cause not to do so.

**统计学**

**Feeds**

Global struct or separate globals for callback optimization?

You should only be using global variables when you have no other option, and you almost always have. In the context of a GUI, y...

13 days 前 | 0

| 已接受

How do I preallocate memory

A third way to do it: loop backwards. for ii = numel(hucPoly):-1:1 This also replaces the call to the length function. I...

20 days 前 | 1

Big CSV file read in matlab

You can use fgetl to read a single line. Do that in a loop to retrieve 5000 lines (or something like that). Then you do whatever...

21 days 前 | 0

save tic toc in duration style

The code below removes the cargo cult programming, removes the sprintf where you aren't actually using it to format a string, an...

1 month 前 | 0

How to keep the original layout in the full screen or when maximizing the GUI of a MATLAB App ?

You should set the units to Normalized. That will scale the sizes of the buttons as you expect. There is an art to this, sinc...

1 month 前 | 0

| 已接受

looping thru multiple line data in UIAxes plot and writing all X,Y data to an array

I would suggest a struct array. That way you can store all relevant properties and you can fairly easy recreate the line objects...

1 month 前 | 0

Reading in .txt File

Your file is not a table, but is more like a struct. Usually such a file would use a JSON format, but you are not in luck. Wh...

2 months 前 | 0

| 已接受

How do I close an open instrument handle following an error?

You may be interested in oncleanup. When a variable goes out of scope, that function can run code. Alternatively you can put ...

2 months 前 | 0

| 已接受

Please help me make my code more efficient

I don't see any way to fundamentally change how your code works to speed it up, other than performing the row swaps in one call:...

3 months 前 | 1

| 已接受

How to save matrix as a "pretty print" image?

Depending on your definition of pretty, you can use my text2im function. If you use sprintf, don't forget to transpose the array...

3 months 前 | 1

| 已接受

How do I get the x and y values of the zoomed in portion of a linear plot from matlab figure?

You can use the XLim and YLim properties to find out the exact x and y ranges. Then you can use logical indexing to select the p...

3 months 前 | 0

| 已接受

cannot find downloaded files!

These download+install programs tend to download file in two locations: your downloads folder and your temp folder. I don't know...

3 months 前 | 0

Concatenating a cell array

The assignment tells you to use a for loop. So even if it can be solved without one, let's do it. But before we can do that, we ...

3 months 前 | 0

| 已接受

已提交

Wayback Machine API

This functions acts as an API for the Wayback Machine (web.archive.org).

3 months 前 | 1 次下载 |

Evaluating function handles without writting inputs

The only way I can think of would be by wrapping the anonymous functions. x=5;y=10; f=@(x,y) x.^2+y.^2; f=@() f(x,y); phi ...

3 months 前 | 0

Fastest way of opening a text file and converting it to a matrix?

doc fscanf If you know the format, using that knowledge always improves speed, since the more complicated tools don't need t...

4 months 前 | 0

Delete part of a 4D array

Let's try something: try data=rand(4,3,5,6); data(1:2,3,:,:)=[]; catch ME warning('error: %s',ME.message) end ...

4 months 前 | 0

use struct in loop for

I fully agree with Dyuman and Stephen. As to the source of the error in this code: the error message is giving you a hint. So...

4 months 前 | 0

how to do for loop 2nd level?

Your code can be optimized, but here are the minimal changes. beam = {'A';'B';'C';'D';'E';'F';'G';'H';'I';'J';'K';'L';'M';'N';'...

4 months 前 | 0

| 已接受

Store values from loop

If you want to store results from all iterations, you need to store them and not overwrite them: res1 = cell(1,100);index = 0; ...

5 months 前 | 0

| 已接受

M-scripting tutorial

If you want to learn the Matlab basics you may consider doing the Onramp tutorial (which is provided for free by Mathworks). If...

5 months 前 | 0

Using string variable names for dot indexing

You're missing parentheses: varnames = {'rsrp_nr' 'sinr_nr'}; T=table(pi,2*pi,VariableName={'rsrp_nr' 'sinr_nr'}) T.(varnames...

5 months 前 | 1

define function in one line

I don't know if you want to avoid anonymous functions as well, but this should give you a finer plot: % p = sin(t) when t<0.6 ...

5 months 前 | 0

| 已接受

Clear distinction between positive and negative in colorbar

I would suggest using the top half of viridis and the bottom half of plasma (or the reverse). You can get both of them here. Th...

5 months 前 | 1

how can I extract values from a struct matrix that contains only one value to make single matrix from it?

Using numbered field names is a bad idea. It is almost as bad as using numbered variable names directly. The solution is to use...

6 months 前 | 0

What to do if my script gives error "The input was too complicated or too big for MATLAB to parse"?

I know I'm almost 7 years late to the party, but I just ran into this problem and was able to find a source and solution. For m...

6 months 前 | 1

I have a matrix problem to solve; A = (:,1) and B = (:,1) and C(:,1) matrixes. This I need in the tensor form like shown in the figure. How to calculate the determinant.

Use the zeros and size functions to generate the zeros row by row. Once you have the matrix you can use the det function to calc...

6 months 前 | 0