Answered

Comparing common strings in two large string arrays imported from excel (using xlsread)

%Generating a demo cell array C = cell(10000, 2); for j = 1:numel(C) C{j, 1} = sprintf('STRR %d', j); C{j, 2} = spri...

Comparing common strings in two large string arrays imported from excel (using xlsread)

%Generating a demo cell array C = cell(10000, 2); for j = 1:numel(C) C{j, 1} = sprintf('STRR %d', j); C{j, 2} = spri...

6 Monate ago | 0

Answered

Switch-case problem

ibw wasn't defined if gender is not '1' or '2', which are char. You want gender to be a double of value 1 or 2. Here's a fix. s...

Switch-case problem

ibw wasn't defined if gender is not '1' or '2', which are char. You want gender to be a double of value 1 or 2. Here's a fix. s...

6 Monate ago | 0

Answered

Code only works in the command window

Looks like your while loop counter index, k, is going above the row count of matriz. For instance, check these simpler codes out...

Code only works in the command window

Looks like your while loop counter index, k, is going above the row count of matriz. For instance, check these simpler codes out...

6 Monate ago | 0

| accepted

Answered

Attempt to grow array along ambiguous dimension.

A = zeros(3, 3, 3); % There are 27 elements in A in a 3x3x3 matrix A(3^3+1) = 1; %ERROR: Attempt to grow array along ambiguous...

Attempt to grow array along ambiguous dimension.

A = zeros(3, 3, 3); % There are 27 elements in A in a 3x3x3 matrix A(3^3+1) = 1; %ERROR: Attempt to grow array along ambiguous...

7 Monate ago | 0

Answered

Unexpected MATLAB expression.

function [header, time, xyz, light, button, prop_val] = read_bin('CGGM.bin', varargin) ...

Unexpected MATLAB expression.

function [header, time, xyz, light, button, prop_val] = read_bin('CGGM.bin', varargin) ...

7 Monate ago | 0

| accepted

Answered

Auto-code friendly functions

You'll need to look through these supported Matlab functions for automatic code generation. https://www.mathworks.com/help/code...

Auto-code friendly functions

You'll need to look through these supported Matlab functions for automatic code generation. https://www.mathworks.com/help/code...

7 Monate ago | 0

| accepted

Answered

Need to iterate through an array faster

Do not use read. Use readFrame instead, since read will re-read everything from beginning to end. i = 1; while hasFrame(vidObj...

Need to iterate through an array faster

Do not use read. Use readFrame instead, since read will re-read everything from beginning to end. i = 1; while hasFrame(vidObj...

7 Monate ago | 1

Answered

Simplifying a "if" statement that checks there is at most one vector

a = [1 0 0 1]; b = [2 2 1 2]; c = 4; if sum(~cellfun(@isscalar, {a b c})) > 1 %You have more than 1 non-scalar fprintf...

Simplifying a "if" statement that checks there is at most one vector

a = [1 0 0 1]; b = [2 2 1 2]; c = 4; if sum(~cellfun(@isscalar, {a b c})) > 1 %You have more than 1 non-scalar fprintf...

7 Monate ago | 0

| accepted

Answered

How to set the whole values in the "y" axis?

https://www.mathworks.com/matlabcentral/answers/398481-how-do-i-remove-scientific-notation-from-x-y-axes-on-plotted-data See po...

How to set the whole values in the "y" axis?

https://www.mathworks.com/matlabcentral/answers/398481-how-do-i-remove-scientific-notation-from-x-y-axes-on-plotted-data See po...

7 Monate ago | 2

| accepted

Answered

Is anyone out there using Matlab in the arts?

I believe the issue is that the Matlab Compiler license is many thousands of dollars... Plus, Stuart probably needs the other to...

Is anyone out there using Matlab in the arts?

I believe the issue is that the Matlab Compiler license is many thousands of dollars... Plus, Stuart probably needs the other to...

7 Monate ago | 0

| accepted

Answered

Simpler code for aggregating data by sum

A=[4 0.5;4 0.25;1 0.125; 2 0.2;4 0.6;3 0.2; 1 2/3; 2 1; 2 1/16;4 0.5] Results = [unique(A(:, 1)), accumarray(A(:, 1), A(:, 2))]...

Simpler code for aggregating data by sum

A=[4 0.5;4 0.25;1 0.125; 2 0.2;4 0.6;3 0.2; 1 2/3; 2 1; 2 1/16;4 0.5] Results = [unique(A(:, 1)), accumarray(A(:, 1), A(:, 2))]...

7 Monate ago | 0

| accepted

Answered

Does using my laptop while running MATLAB influence performance

Yes, if your browser and other OS are using a lot of resources. Computer resources are limited, hence, if other non-Matlab progr...

Does using my laptop while running MATLAB influence performance

Yes, if your browser and other OS are using a lot of resources. Computer resources are limited, hence, if other non-Matlab progr...

7 Monate ago | 1

| accepted

Answered

Question about concatenation in for-loop

Instead of cat, use repmat for your case, as you're repeatedly stacking a matrix in a dimension. B = rand(2, 5) C = repmat(B, ...

Question about concatenation in for-loop

Instead of cat, use repmat for your case, as you're repeatedly stacking a matrix in a dimension. B = rand(2, 5) C = repmat(B, ...

7 Monate ago | 1

| accepted

Answered

control of switch button with another switch button

function test Gx = uifigure('Position',[100 100 350 275]); % Create switch1 UI1 = uiswitch(Gx, 'rocker',... 'Tag', 'sw...

control of switch button with another switch button

function test Gx = uifigure('Position',[100 100 350 275]); % Create switch1 UI1 = uiswitch(Gx, 'rocker',... 'Tag', 'sw...

7 Monate ago | 0

| accepted

Answered

GPU and CPU code: How to do?

Depending on how your codes are structured, try to decide early on whether to use gpuArray or regular array. Most Matlab built-i...

GPU and CPU code: How to do?

Depending on how your codes are structured, try to decide early on whether to use gpuArray or regular array. Most Matlab built-i...

7 Monate ago | 1

| accepted

Answered

normalizing a normal distribution

The normpdf returns the PDF in terms of %. To normalize to fraction, divide the output of normpdf by 100. If you compute PDF fo...

normalizing a normal distribution

The normpdf returns the PDF in terms of %. To normalize to fraction, divide the output of normpdf by 100. If you compute PDF fo...

7 Monate ago | 0

| accepted

Answered

Can anyone give me the exact statement I must use to prevent this additional line from coming between the plot extremities?

Seems like your X values are not sorted, causing the lines to loop around. To fix, sort your X and Y values. See example below: ...

Can anyone give me the exact statement I must use to prevent this additional line from coming between the plot extremities?

Seems like your X values are not sorted, causing the lines to loop around. To fix, sort your X and Y values. See example below: ...

7 Monate ago | 0

| accepted

Answered

How to vectorize a matrix?

%Starting input M = reshape(1:90*12, 90, 12); %your 90x12 lookup matrix X = [0 1 3 4 89]; %input X lookup Y = [0 1 3 5 11]; %...

How to vectorize a matrix?

%Starting input M = reshape(1:90*12, 90, 12); %your 90x12 lookup matrix X = [0 1 3 4 89]; %input X lookup Y = [0 1 3 5 11]; %...

7 Monate ago | 1

| accepted

Answered

Running a function script

To debug a function that is part of a larger set of codes, perhaps you should use debugging features such as code breaks and dbs...

Running a function script

To debug a function that is part of a larger set of codes, perhaps you should use debugging features such as code breaks and dbs...

7 Monate ago | 0

Answered

How do I convert a CSV formatted string to a table or timetable?

NEW ANSWER Try a variation of this, where your CSV-formatted string is directly read and converted to a table. TextStr = ['ti...

How do I convert a CSV formatted string to a table or timetable?

NEW ANSWER Try a variation of this, where your CSV-formatted string is directly read and converted to a table. TextStr = ['ti...

7 Monate ago | 1

| accepted

Answered

How to make multiple variables equal a class?

Try the following testGame.m to see how to use object-oriented programming in Matlab. You'll need to define classes via classdef...

How to make multiple variables equal a class?

Try the following testGame.m to see how to use object-oriented programming in Matlab. You'll need to define classes via classdef...

7 Monate ago | 1

| accepted

Answered

Why is my program not being coverted into an application properly specifically the sound doesn't start playing in the converted program

Seems like you are using relative paths. When using deployed application, the paths are different. Use absolute paths. functio...

Why is my program not being coverted into an application properly specifically the sound doesn't start playing in the converted program

Seems like you are using relative paths. When using deployed application, the paths are different. Use absolute paths. functio...

9 Monate ago | 0

Answered

Unusual NaN appearing from a loop

It seems that you are taking the median of an empty number %EXAMPLE data = [1 2 3]; Quart2 = 4; Quart1 = median(data(Quart2 ...

Unusual NaN appearing from a loop

It seems that you are taking the median of an empty number %EXAMPLE data = [1 2 3]; Quart2 = 4; Quart1 = median(data(Quart2 ...

9 Monate ago | 0

Answered

Can anybody plz explain this code,specifically the 5th line..

An image is often represented as a MxNx3 matrix, where each element of a matrix is a uint8 value ranging from 0 to 255 (this is ...

Can anybody plz explain this code,specifically the 5th line..

An image is often represented as a MxNx3 matrix, where each element of a matrix is a uint8 value ranging from 0 to 255 (this is ...

10 Monate ago | 1

Answered

How to determine if a cell has numeric data?

% checkCellForNum will look at each element of a cell array to look for numeric % elements. Returns a logical array of 1 f...

How to determine if a cell has numeric data?

% checkCellForNum will look at each element of a cell array to look for numeric % elements. Returns a logical array of 1 f...

10 Monate ago | 0

Answered

What's the code Intelligent water drop algorithm

Look up "intelligent water drops algorithm" on the search engine. I got the 1st hit as the pdf. I couldn't find a matlab ve...

What's the code Intelligent water drop algorithm

Look up "intelligent water drops algorithm" on the search engine. I got the 1st hit as the pdf. I couldn't find a matlab ve...

10 Monate ago | 2

| accepted

Answered

My code keeps telling me with an error "Index Exceeds Array Bounds" HELP PLEASE

At line 54: * You cannot read a .xlsx file properly via |fopen|. Use |xlsread| instead. * You should define "Path" variable...

My code keeps telling me with an error "Index Exceeds Array Bounds" HELP PLEASE

At line 54: * You cannot read a .xlsx file properly via |fopen|. Use |xlsread| instead. * You should define "Path" variable...

10 Monate ago | 0

| accepted

Answered

How to find mean of cells?

You should consider extracting your variables out from cell arrays to simple matrices. Then you can use |nanmean|. Here are some...

How to find mean of cells?

You should consider extracting your variables out from cell arrays to simple matrices. Then you can use |nanmean|. Here are some...

10 Monate ago | 0

Answered

Call subfunction many times: Nested or local

In-line codes are normally fastest, but you should use local function if: * it is going to be used ONLY by the main function ...

Call subfunction many times: Nested or local

In-line codes are normally fastest, but you should use local function if: * it is going to be used ONLY by the main function ...

10 Monate ago | 1

| accepted

Answered

printing matching lines of text from a text file

This looks like a bad approach. If your input file uses a 3-digit degree, then all your values are ruined. lat_deg = str2...

printing matching lines of text from a text file

This looks like a bad approach. If your input file uses a 3-digit degree, then all your values are ruined. lat_deg = str2...

10 Monate ago | 0

| accepted